Is there a way to use libstdcxx
with clang
on macOS? The Nix code for libstdcxxClang
seems to suggest that (since libcxx == null
) that no attempt of using libstdcxx
is done if the system is darwin
.
I’m trying to do this to get -std=c++20
working, but Nixpkgs doesn’t seem to have a libcxx
new enough for that.
What I’ve tried:
let gccShell = pkgs.mkShell.override {
# Use gcc11 for our shell environment. We don't have a clang13Stdenv.
stdenv = pkgs.gcc11Stdenv;
};
clang = pkgs.llvmPackages_latest.libstdcxxClang;
clangFlags = ''
-g
-O1
-DNDEBUG
-pthread
-std=c++20
-I./
-DUSING_TOMS_SUGGESTIONS
-D__func__=__PRETTY_FUNCTION__
-stdlib=libstdc++
-Weverything
-Wno-comma
-Wno-unused-template
-Wno-sign-conversion
-Wno-exit-time-destructors
-Wno-global-constructors
-Wno-missing-prototypes
-Wno-weak-vtables
-Wno-padded
-Wno-double-promotion
-Wno-c++98-compat-pedantic
-Wno-c++11-compat-pedantic
-Wno-c++14-compat-pedantic
-Wno-c++17-compat-pedantic
-Wno-c++20-compat-pedantic
-fdiagnostics-show-category=name
-Wno-zero-as-null-pointer-constant
-Wno-ctad-maybe-unsupported
'';
in gccShell {
buildInputs = with pkgs; [
clang
gcc11
];
}
When built, I get errors related to headers not being found, like 'cmath' file not found
, so clang
is presumably not seeing the libstdcxx
.