Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

llvmPackages_git.libcxx: use clang from git instead of the stdenv's compiler

Port of ca59a201ca1 ("llvmPackages_15.libcxx: use clang 15 instead of
the stdenv's compiler").

+30 -11
+23 -11
pkgs/development/compilers/llvm/git/default.nix
··· 257 258 libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang; 259 260 - libcxx = callPackage ./libcxx { 261 - inherit llvm_meta; 262 - stdenv = if stdenv.hostPlatform.useLLVM or false 263 - then overrideCC stdenv buildLlvmTools.clangNoLibcxx 264 - else stdenv; 265 - }; 266 - 267 libcxxabi = let 268 - stdenv_ = if stdenv.hostPlatform.useLLVM or false 269 - then overrideCC stdenv buildLlvmTools.clangNoLibcxx 270 - else stdenv; 271 cxx-headers = callPackage ./libcxx { 272 inherit llvm_meta; 273 - stdenv = stdenv_; 274 headersOnly = true; 275 }; 276 in callPackage ./libcxxabi { 277 stdenv = stdenv_; 278 inherit llvm_meta cxx-headers; 279 }; 280 281 libunwind = callPackage ./libunwind {
··· 257 258 libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang; 259 260 libcxxabi = let 261 + # CMake will "require" a compiler capable of compiling C++ programs 262 + # cxx-header's build does not actually use one so it doesn't really matter 263 + # what stdenv we use here, as long as CMake is happy. 264 cxx-headers = callPackage ./libcxx { 265 inherit llvm_meta; 266 headersOnly = true; 267 }; 268 + 269 + # `libcxxabi` *doesn't* need a compiler with a working C++ stdlib but it 270 + # *does* need a relatively modern C++ compiler (see: 271 + # https://releases.llvm.org/15.0.0/projects/libcxx/docs/index.html#platform-and-compiler-support). 272 + # 273 + # So, we use the clang from this LLVM package set, like libc++ 274 + # "boostrapping builds" do: 275 + # https://releases.llvm.org/15.0.0/projects/libcxx/docs/BuildingLibcxx.html#bootstrapping-build 276 + # 277 + # We cannot use `clangNoLibcxx` because that contains `compiler-rt` which, 278 + # on macOS, depends on `libcxxabi`, thus forming a cycle. 279 + stdenv_ = overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc; 280 in callPackage ./libcxxabi { 281 stdenv = stdenv_; 282 inherit llvm_meta cxx-headers; 283 + }; 284 + 285 + # Like `libcxxabi` above, `libcxx` requires a fairly modern C++ compiler, 286 + # so: we use the clang from this LLVM package set instead of the regular 287 + # stdenv's compiler. 288 + libcxx = callPackage ./libcxx { 289 + inherit llvm_meta; 290 + stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; 291 }; 292 293 libunwind = callPackage ./libunwind {
+7
pkgs/development/compilers/llvm/git/libcxxabi/default.nix
··· 58 cmakeFlags = [ 59 "-DLLVM_ENABLE_RUNTIMES=libcxxabi" 60 "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" 61 ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ 62 "-DLLVM_ENABLE_LIBCXX=ON" 63 "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
··· 58 cmakeFlags = [ 59 "-DLLVM_ENABLE_RUNTIMES=libcxxabi" 60 "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" 61 + 62 + # `libcxxabi`'s build does not need a toolchain with a c++ stdlib attached 63 + # (we specify the headers it should use explicitly above). 64 + # 65 + # CMake however checks for this anyways; this flag tells it not to. See: 66 + # https://github.com/llvm/llvm-project/blob/4bd3f3759259548e159aeba5c76efb9a0864e6fa/llvm/runtimes/CMakeLists.txt#L243 67 + "-DCMAKE_CXX_COMPILER_WORKS=ON" 68 ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ 69 "-DLLVM_ENABLE_LIBCXX=ON" 70 "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"