Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld -v doesn't see language.c.libraries #224

Open
kubukoz opened this issue Sep 25, 2022 · 0 comments
Open

ld -v doesn't see language.c.libraries #224

kubukoz opened this issue Sep 25, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@kubukoz
Copy link

kubukoz commented Sep 25, 2022

Describe the bug

This may not be a bug but rather me misusing the software, but here goes:

I tried adding some C libraries to the shell using the c.nix module in extras.

The module seem to work, as I have LD_LIBRARY_PATH and C_INCLUDE_PATH set in a seemingly correct way. However, the ld in the shell doesn't seem to see any of the libraries I included, which is a change from the behavior of nativeBuildInputs in a normal shell.

Is there some option I'm not using, which would make ld see the libraries?

To Reproduce

Steps to reproduce the behavior:

{
  inputs = {
    devshell.url = "github:numtide/devshell?rev=e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66";
    flake-utils.url = "github:numtide/flake-utils?rev=c0e246b9b83f637f4681389ecabcb2681b4f3af0";
  };

  outputs = { self, nixpkgs, devshell, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ devshell.overlay ];
        };
      in
      {
        devShell = pkgs.devshell.mkShell {
          imports = [
            "${pkgs.devshell.extraModulesDir}/language/c.nix"
          ];
          language.c = {
            libraries = [ pkgs.s2n-tls pkgs.zlib pkgs.openssl ];
            includes = [ pkgs.zlib ];
          };
        };
      }
    );
}
  1. Enter shell with direnv / nix develop

  2. Run ld -v

@(#)PROGRAM:ld  PROJECT:ld64-530
BUILD 23:18:04 Aug 25 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
Library search paths:
        /nix/store/bhlcyrh0zx99d84a0pvyil82cnp4mzfh-libSystem-11.0.0/lib
Framework search paths:
ld: no object files specified

Expected behavior

libs2n, libz, libopenssl's paths are visible

System information

  • macOS 12.5.1 Monterey

Additional context

@kubukoz kubukoz added the bug Something isn't working label Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant