Skip to content

Commit

Permalink
Clang compatibility
Browse files Browse the repository at this point in the history
Add `-x c++` to `CXX_FLAGS` to enable C++ compilcation with `clang`.
Shift `-lstdc++` and `-lm` into `LINK_LIBS` to avoid missing symbol
errors when linking C++ with `clang`.
  • Loading branch information
aherrmann committed Nov 30, 2020
1 parent 85ee736 commit 6d6fc1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nixpkgs/toolchains/cc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ in
# Keep stack frames for debugging, even in opt mode.
-fno-omit-frame-pointer
)
CXX_FLAGS=(-std=c++0x)
CXX_FLAGS=(
-x c++
-std=c++0x
)
LINK_FLAGS=(
$(
if [[ -x ${cc}/bin/ld.gold ]]; then echo -fuse-ld=gold; fi
Expand All @@ -176,10 +179,11 @@ in
# Have gcc return the exit code from ld.
add_compiler_option_if_supported -pass-exit-codes
)
)
LINK_LIBS=(
-lstdc++
-lm
)
LINK_LIBS=()
OPT_COMPILE_FLAGS=(
# No debug symbols.
# Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or
Expand Down

0 comments on commit 6d6fc1b

Please sign in to comment.