Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvmPackages_{15}.libcxxStdenv: fix '__cxxabi_config.h' file not found #255756

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pkgs/development/compilers/llvm/15/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,16 @@ stdenv.mkDerivation rec {

cmakeFlags = let
# See: https://libcxx.llvm.org/BuildingLibcxx.html#cmdoption-arg-libcxx-cxx-abi-string
libcxx_cxx_abi_opt = {
"c++abi" = "system-libcxxabi";
"cxxrt" = "libcxxrt";
# And: https://github.com/llvm/llvm-project/blob/aa656f6c2dec73faceeed21e15401d8f0c743c8b/libcxx/cmake/Modules/HandleLibCXXABI.cmake#L82-L180
libcxx_cxx_abi_options = {
"c++abi" = { name = "system-libcxxabi"; headers = "${cxxabi.dev}/include/c++/v1"; };
"cxxrt" = { name = "libcxxrt"; headers = "${cxxabi}/include"; };
}.${cxxabi.libName} or (throw "unknown cxxabi: ${cxxabi.libName} (${cxxabi.pname})");
in [
"-DLLVM_ENABLE_RUNTIMES=libcxx"
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_opt}"
] ++ lib.optional (!headersOnly && cxxabi.libName == "c++abi") "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi.dev}/include/c++/v1"
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_options.name}"
] ++ lib.optional (!headersOnly) "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${libcxx_cxx_abi_options.headers}"
++ lib.optional (!headersOnly) "-DLIBCXX_CXX_ABI_LIBRARY_PATH=${cxxabi}/lib"
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLIBCXX_USE_COMPILER_RT=ON"
Expand Down
7 changes: 7 additions & 0 deletions pkgs/test/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions pkgs/test/cc-wrapper/include-cxxabi.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <cxxabi.h>
#include <iostream>

int main(int argc, char **argv)
{
std::cerr << "ok" << std::endl;
return 0;
}