Skip to content

Commit

Permalink
Pass the unwrapped cc to wrapCCWith
Browse files Browse the repository at this point in the history
The `wrapCCWith` function assumes that the `cc` attribute it is passed is an unwrapped
`cc` since it adds its `/lib` directory to the linker search path.

Passing an already wrapped `cc` here causes `ld` to issue warnings about the directory was
not found, since for a wrapped `cc` it does not exist.
  • Loading branch information
avdv committed Jul 12, 2022
1 parent ff98f6e commit a8e2978
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions toolchains/cc/cc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ let
# Work around https://github.com/NixOS/nixpkgs/issues/42059.
# See also https://github.com/NixOS/nixpkgs/pull/41589.
pkgs.wrapCCWith rec {
cc = pkgs.stdenv.cc;
bintools = cc.bintools.override { inherit postLinkSignHook; };
cc = pkgs.stdenv.cc.cc;
bintools = pkgs.stdenv.cc.bintools.override { inherit postLinkSignHook; };
extraBuildCommands = with pkgs.darwin.apple_sdk.frameworks; ''
echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
echo "-isystem ${pkgs.llvmPackages.libcxx.dev}/include/c++/v1" >> $out/nix-support/cc-cflags
Expand All @@ -41,12 +41,6 @@ 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 a8e2978

Please sign in to comment.