llvm-project
llvm-project copied to clipboard
[llvm 14] clang++ not including custom gcc include paths
Hi,
I tried to update our software stack to LLVM 14.0.6 but noticed that clang++ is not searching headers in my custom gcc directory [b]. It worked fine for llvm 12.0.1 [a]. This is causing compilation errors as clang++ is not able to find memory_resource
. Any idea how to avoid/fix this issue?
Thanks,
[a] LLVM 12
> which g++
/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10/bin/g++
> clang++ --print-search-dirs
programs: =/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10:/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/llvm/12.0.1-dd4c586a5bebc335346bb0e879f6f0aa/bin:/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10/lib/gcc/x86_64-redhat-linux-gnu/10.3.0/../../../../x86_64-redhat-linux-gnu/bin
libraries: =/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/llvm/12.0.1-dd4c586a5bebc335346bb0e879f6f0aa/lib64/clang/12.0.1:/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10/lib/gcc/x86_64-redhat-linux-gnu/10.3.0:/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10/lib/gcc/x86_64-redhat-linux-gnu/10.3.0/../../../../lib64:/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/llvm/12.0.1-dd4c586a5bebc335346bb0e879f6f0aa/bin/../lib64:/lib/../lib64:/usr/lib/../lib64:/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10/lib/gcc/x86_64-redhat-linux-gnu/10.3.0/../../../../x86_64-redhat-linux-gnu/lib:/cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10/lib/gcc/x86_64-redhat-linux-gnu/10.3.0/../../..:/lib:/usr/lib
[b] LLVM 14
> which gcc
/cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10/bin/gcc
> clang++ --print-search-dirs
programs: =/cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/gcc/10.3.0-84898dea653199466402e67d73657f10:/cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/llvm/14.0.6-be34f65399c081aae892f70eb0377d30/bin:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/bin
libraries: =/cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/llvm/14.0.6-be34f65399c081aae892f70eb0377d30/lib64/clang/14.0.6:/usr/lib/gcc/x86_64-redhat-linux/8:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64:/lib/../lib64:/usr/lib/../lib64:/lib:/usr/lib
> clang++ -E -x c++ - -v
clang version 14.0.6
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/llvm/14.0.6-be34f65399c081aae892f70eb0377d30/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/8
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation: /cvmfs/cms-ib.cern.ch/nweek-02739/el8_amd64_gcc10/external/cuda/11.5.2-c927b7e765e06433950d8a7eab9eddb4, version 11.5
(in-process)
"/cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/llvm/14.0.6-be34f65399c081aae892f70eb0377d30/bin/clang-14" -cc1 -triple x86_64-redhat-linux-gnu -E -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v -fcoverage-compilation-dir=/build/muz/d/CMSSW_12_5_CLANG_X_2022-06-30-2300 -resource-dir /cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/llvm/14.0.6-be34f65399c081aae892f70eb0377d30/lib64/clang/14.0.6 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward -internal-isystem /cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/llvm/14.0.6-be34f65399c081aae892f70eb0377d30/lib64/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir=/build/muz/d/CMSSW_12_5_CLANG_X_2022-06-30-2300 -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o - -x c++ -
clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-redhat-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward
/cvmfs/cms-ci.cern.ch/week1/PR_8803ebed/el8_amd64_gcc10/external/llvm/14.0.6-be34f65399c081aae892f70eb0377d30/lib64/clang/14.0.6/include
/usr/local/include
/usr/include
End of search list.
@llvm/issue-subscribers-clang-driver
ping
any fix/workaround for this?
I just wrote this Stack Overflow answer that might help, especially Solution 2.
thanks @klalumiere for the pointer to the stack overflow. export CCC_OVERRIDE_OPTIONS=^--gcc-toolchain=/path/to/my/gcc
works but then I see messages like [a] for each compilation which our developers do not like. For now we just pass --gcc-toolchain=/path/to/my/gcc
to clang++
[a]
### Adding argument --gcc-toolchain=/path/to/my/gcc at beginning
### CCC_OVERRIDE_OPTIONS: ^--gcc-toolchain=/path/to/my/gcc