From 32e3b8754d4ec4db3eb2c2fd3ff9d2449dd3ddc0 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Fri, 10 Jun 2022 09:52:32 +0200 Subject: [PATCH] Avoid linker warning about non-existent directory 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...`. --- toolchains/cc/cc.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toolchains/cc/cc.nix b/toolchains/cc/cc.nix index 63fabed9..16948dd4 100644 --- a/toolchains/cc/cc.nix +++ b/toolchains/cc/cc.nix @@ -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 =