Merge pull request #255488 from natto1784/libcxxabi

This commit is contained in:
Artturi 2023-09-20 09:12:51 +03:00 committed by GitHub
commit 6f27ba80ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 8 deletions

View File

@ -469,6 +469,7 @@ stdenv.mkDerivation {
''
+ optionalString (libcxx.isLLVM or false) ''
echo "-isystem ${lib.getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
echo "-isystem ${lib.getDev libcxx.cxxabi}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
echo "-l${libcxx.cxxabi.libName}" >> $out/nix-support/libcxx-ldflags
''

View File

@ -255,14 +255,6 @@ in let
[ "-rtlib=compiler-rt"
"-Wno-unused-command-line-argument"
"-B${targetLlvmLibraries.compiler-rt}/lib"
# Combat "__cxxabi_config.h not found". Maybe this could be fixed by
# copying these headers into libcxx? Note that building libcxx
# outside of monorepo isn't supported anymore, might be related to
# https://github.com/llvm/llvm-project/issues/55632
# ("16.0.3 libcxx, libcxxabi: circular build dependencies")
# Looks like the machinery changed in https://reviews.llvm.org/D120727.
"-I${lib.getDev targetLlvmLibraries.libcxx.cxxabi}/include/c++/v1"
]
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
++ lib.optional

View File

@ -30,6 +30,13 @@ in stdenv.mkDerivation {
$CXX -o cxx-check ${./cxx-main.cc}
${emulator} ./cxx-check
# test for https://github.com/NixOS/nixpkgs/issues/214524#issuecomment-1431745905
# .../include/cxxabi.h:20:10: fatal error: '__cxxabi_config.h' file not found
# in libcxxStdenv
echo "checking whether cxxabi.h can be included... " >&2
$CXX -o include-cxxabi ${./include-cxxabi.cc}
${emulator} ./include-cxxabi
${lib.optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
echo "checking whether compiler can build with CoreFoundation.framework... " >&2
mkdir -p foo/lib

View File

@ -0,0 +1,8 @@
#include <cxxabi.h>
#include <iostream>
int main(int argc, char **argv)
{
std::cerr << "ok" << std::endl;
return 0;
}