Skip to content

Commit

Permalink
Fix libc++ link option in CC toolchain on Darwin
Browse files Browse the repository at this point in the history
libstdc++ isn't available on Darwin, so it's safe to assume that libc++
is used there. I didn't find a way to detect which one of them is
actually used in stdenv so far.
  • Loading branch information
YorikSar authored and avdv committed May 17, 2022
1 parent c8cff62 commit 734202f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion toolchains/cc/cc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@ pkgs.runCommand "bazel-nixpkgs-cc-toolchain"
)
)
LINK_LIBS=(
-lstdc++
${
# Use pkgs.stdenv.isDarwin as a marker instead of cc.isClang because
# we might have usecases with stdenv with clang and libstdc++.
# On Darwin libstdc++ is not available, so it's safe to assume that
# everybody use libc++ from LLVM.
if pkgs.stdenv.isDarwin then "-lc++" else "-lstdc++"
}
-lm
)
OPT_COMPILE_FLAGS=(
Expand Down

0 comments on commit 734202f

Please sign in to comment.