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

'__cxxabi_config.h' file not found with clang-wrapper #255487

Closed
natto1784 opened this issue Sep 16, 2023 · 3 comments · Fixed by #255488
Closed

'__cxxabi_config.h' file not found with clang-wrapper #255487

natto1784 opened this issue Sep 16, 2023 · 3 comments · Fixed by #255488
Labels
0.kind: bug Something is broken 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related

Comments

@natto1784
Copy link
Contributor

natto1784 commented Sep 16, 2023

Describe the bug

Clang's wrapper does not set ${libcxxabi.dev}/c++/v1 as an include path. Compiling files with <cxxabi.h> fails since <cxxabi.h> requires <__cxxabi_config.h> which is present in the aforementioned path

Minimal Reproduction

#if __has_include(<cxxabi.h>)
#  include <cxxabi.h>
#endif


int main() {
    return 0;
}

Current ouput

clang++ alo.cc

In file included from alo.cc:2:
/nix/store/wk6mn10acxsi3q3hxzhsypwxlf5nmkxa-libcxxabi-16.0.6-dev/include/cxxabi.h:20:10: fatal error: '__cxxabi_config.h' file not found
#include <__cxxabi_config.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.

Verbose

clang++ --verbose alo.cc

clang version 16.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/09ccpv2ny36nfjigv260b2m8rpxccy2j-clang-16.0.6/bin
Found candidate GCC installation: /nix/store/n8dryz4xf7ln028j37zapgzg4j47p743-gcc-12.3.0/lib/gcc/x86_64-unknown-linux-gnu/12.3.0
Found candidate GCC installation: /nix/store/n8dryz4xf7ln028j37zapgzg4j47p743-gcc-12.3.0/lib64/gcc/x86_64-unknown-linux-gnu/12.3.0
Selected GCC installation: /nix/store/n8dryz4xf7ln028j37zapgzg4j47p743-gcc-12.3.0/lib64/gcc/x86_64-unknown-linux-gnu/12.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/nix/store/09ccpv2ny36nfjigv260b2m8rpxccy2j-clang-16.0.6/bin/clang-16" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name alo.cc -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/natto -nostdsysteminc -resource-dir /nix/store/yfw10j91pd0c4aycascgfirq58nwik03-clang-wrapper-16.0.6/resource-root -idirafter /nix/store/4lap45ifj50lp980id60fnbvs81yj9lr-glibc-2.37-8-dev/include -isystem /nix/store/2m1m4lwcr89xwyli8ir6bzkp23ymz738-libcxx-16.0.6-dev/include -isystem /nix/store/wk6mn10acxsi3q3hxzhsypwxlf5nmkxa-libcxxabi-16.0.6-dev/include -isystem /nix/store/fqvx4m5d12jpickwd1jm3lmqf55xq4ln-compiler-rt-libc-16.0.6-dev/include -isystem /nix/store/2m1m4lwcr89xwyli8ir6bzkp23ymz738-libcxx-16.0.6-dev/include -isystem /nix/store/wk6mn10acxsi3q3hxzhsypwxlf5nmkxa-libcxxabi-16.0.6-dev/include -isystem /nix/store/fqvx4m5d12jpickwd1jm3lmqf55xq4ln-compiler-rt-libc-16.0.6-dev/include -isystem /nix/store/2m1m4lwcr89xwyli8ir6bzkp23ymz738-libcxx-16.0.6-dev/include/c++/v1 -U _FORTIFY_SOURCE -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -internal-isystem /nix/store/yfw10j91pd0c4aycascgfirq58nwik03-clang-wrapper-16.0.6/resource-root/include -source-date-epoch 315532800 -O2 -Wformat -Wformat-security -Werror=format-security -fdeprecated-macro -fdebug-compilation-dir=/home/natto -ferror-limit 19 -fwrapv -stack-protector 2 -stack-protector-buffer-size 4 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/nix-shell.kawEoa/nix-shell.3Bf8zw/alo-4bb3ab.o -x c++ alo.cc
clang -cc1 version 16.0.6 based upon LLVM 16.0.6 default target x86_64-unknown-linux-gnu
ignoring duplicate directory "/nix/store/2m1m4lwcr89xwyli8ir6bzkp23ymz738-libcxx-16.0.6-dev/include"
ignoring duplicate directory "/nix/store/wk6mn10acxsi3q3hxzhsypwxlf5nmkxa-libcxxabi-16.0.6-dev/include"
ignoring duplicate directory "/nix/store/fqvx4m5d12jpickwd1jm3lmqf55xq4ln-compiler-rt-libc-16.0.6-dev/include"
#include "..." search starts here:
#include <...> search starts here:
 /nix/store/2m1m4lwcr89xwyli8ir6bzkp23ymz738-libcxx-16.0.6-dev/include
 /nix/store/wk6mn10acxsi3q3hxzhsypwxlf5nmkxa-libcxxabi-16.0.6-dev/include
 /nix/store/fqvx4m5d12jpickwd1jm3lmqf55xq4ln-compiler-rt-libc-16.0.6-dev/include
 /nix/store/2m1m4lwcr89xwyli8ir6bzkp23ymz738-libcxx-16.0.6-dev/include/c++/v1
 /nix/store/yfw10j91pd0c4aycascgfirq58nwik03-clang-wrapper-16.0.6/resource-root/include
 /nix/store/4lap45ifj50lp980id60fnbvs81yj9lr-glibc-2.37-8-dev/include
End of search list.
In file included from alo.cc:2:
/nix/store/wk6mn10acxsi3q3hxzhsypwxlf5nmkxa-libcxxabi-16.0.6-dev/include/cxxabi.h:20:10: fatal error: '__cxxabi_config.h' file not found
#include <__cxxabi_config.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.

Notes

I created the environment using this minimal mkShell expression

mkShell.override { stdenv = llvmPackages_16.libcxxStdenv; } { }

Proposed fix

Adding -isystem ${lib.getDev libcxx.cxxabi}/include/c++/v1 to libcxx-cxxflags

@pwaller
Copy link
Contributor

pwaller commented Sep 16, 2023

Proposed solution seems reasonable to me. See also this discussion started by @Artturin.

@pwaller
Copy link
Contributor

pwaller commented Sep 16, 2023

Please can you also include the nixpkgs commit hash in the repro (sorry if it's there and I missed it).

@natto1784
Copy link
Contributor Author

Proposed solution seems reasonable to me. See also this discussion started by @Artturin.

Oh thank you, that makes so much sense, I was also looking at how the monorepo handles things as well as their tests on finding the system include headers and what you said is probably the correct reason.

Please can you also include the nixpkgs commit hash in the repro (sorry if it's there and I missed it).

Ah, it was the nixpkgs-unstable revision updated just then. Sorry I do not have that, but you can reproduce it with the current master as well.
4f99000fde6a54b2e8496760988011032944fe73

@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants