Skip to content

Commit

Permalink
Avoid linker warning about non-existent directory
Browse files Browse the repository at this point in the history
The `wrapCCWith` function adds the `$cc/lib` directory to the library search path (`-L`) using the
`nix-support/cc-ldflags` file.

Usually, for `stdenv.cc` this directory does not exist and `ld` will warn "directory not found for option `-L...`.
  • Loading branch information
avdv committed Jun 10, 2022
1 parent e554637 commit 32e3b87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions toolchains/cc/cc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ let
echo "-L${pkgs.llvmPackages.libcxxabi}/lib" >> $out/nix-support/cc-cflags
echo "-L${pkgs.libiconv}/lib" >> $out/nix-support/cc-cflags
echo "-L${pkgs.darwin.libobjc}/lib" >> $out/nix-support/cc-cflags
# avoid linker warning about non-existent directory
# > ld: warning: directory not found for option '-L/nix/store/gsfxxazc51sx6vjdrz6cq8s19x7h5mwh-clang-wrapper-7.1.0/lib'
if ! [[ -d '${pkgs.lib.getLib cc}/lib' ]]; then
sed -i -e 's%-L${pkgs.lib.getLib cc}/lib\($\| \)%%' $out/nix-support/cc-ldflags
fi
'';
};
cc =
Expand Down

0 comments on commit 32e3b87

Please sign in to comment.