numtide / devshell

Per project developer environments
https://numtide.github.io/devshell/
MIT License
1.22k stars 87 forks source link

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

Open kubukoz opened 1 year ago

kubukoz commented 1 year ago

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

Additional context