Unverified Commit bd0dd33d authored by Randy Eckenrode's avatar Randy Eckenrode
Browse files

cc-wrapper: always include libc++ in the search path

The libc++ headers are expected to be found in the sysroot when `clang`
is invoked for C++ code.

Always making them available improves compatibility with build systems
like Bazel and SwiftPM, which try to compile C++ code with `clang`.
parent 095530e4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -140,6 +140,15 @@ if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then
    params=(${kept+"${kept[@]}"})
fi

# Some build systems such as Bazel and SwiftPM use `clang` instead of `clang++`,
# which will find the libc++ headers in the sysroot for C++ files.
if [[ "$isCxx" = 0 && "@isClang@" ]]; then
# This duplicates the behavior of a native toolchain, which can find the
# libc++ headers but requires `-lc++` to be specified explicitly when linking.
    isCxx=1
    cxxLibrary=0
fi

if [[ "$isCxx" = 1 ]]; then
    if [[ "$cxxInclude" = 1 ]]; then
        #