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

Clang uses system include files instead of GCC-Toolchain ones #2583

Open
marcovanleeuwen opened this issue Nov 4, 2020 · 1 comment
Open

Comments

@marcovanleeuwen
Copy link
Contributor

marcovanleeuwen commented Nov 4, 2020

Hi Giulio, all,

I am trying to compile O2 on SL6 (unsupported, I know; the error below may however come to bite us on other platforms as well?) and get an error when aliBuild is doing a test compilation within the clang build script ($INSTALLROOT/bin-safe/clang++ -v -c test.cc).

The underlying issue seems to be that it picks up the system gcc and includes, instead of the GCC-Toolchain version:

Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data1/software/alisoft/INSTALLROOT/ae8bbd59f63481f0629333a5d157d37be09c41a7/slc6_x86-64/Clang/v10.0.1-1/bin-safe
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.4.4
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/3.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7
....
clang -cc1 version 10.0.1 based upon LLVM 10.0.1 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward
/usr/local/include
/data1/software/alisoft/INSTALLROOT/ae8bbd59f63481f0629333a5d157d37be09c41a7/slc6_x86-64/Clang/v10.0.1-1/lib/clang/10.0.1/include
/usr/include
End of search list.

I can counteract this by specifying the
--gcc-toolchain=/data1/software/alisoft/slc6_x86-64/GCC-Toolchain/v7.3.0-alice2-1
flag, but this would likely cause problems down the line. Do you know how to set this by default?

I check the compilation logs, and cmake correctly uses GCC 7.3.0:

++ cmake /data1/software/alisoft/SOURCES/Clang/v10.0.1/llvmorg-10.0.1/llvm '-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;compiler-rt' -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/data1/software/alisoft/INSTALLROOT/ae8bbd59f63481f0629333a5d157d37be09c41a7/slc6_x86-64/Clang/v10.0.1-1 -DLLVM_INSTALL_UTILS=ON -DPYTHON_EXECUTABLE=/data1/software/alisoft/slc6_x86-64/Python/v3.6.10-4/bin/python3 -DDEFAULT_SYSROOT= -DLLVM_BUILD_LLVM_DYLIB=ON -DBUILD_SHARED_LIBS=OFF
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /data1/software/alisoft/slc6_x86-64/GCC-Toolchain/v7.3.0-alice2-1/bin/cc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /data1/software/alisoft/slc6_x86-64/GCC-Toolchain/v7.3.0-alice2-1/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /data1/software/alisoft/slc6_x86-64/GCC-Toolchain/v7.3.0-alice2-1/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done

but somehow it seems that this is not used at run-time.

Best regards,

Marco.

@marcovanleeuwen
Copy link
Contributor Author

Hi Guilio, all,

I looked a bit more into this and I see the same feature on SL7 with the clang and GCC 7.3 from CVMFS:

[marcovl@stbc-i1 ~]$ alienv enter VO_ALICE@O2::nightly-20201110-1
[O2/nightly-20201110-1] ~ > which clang
/cvmfs/alice.cern.ch/el7-x86_64/Packages/Clang/v10.0.1-17/bin-safe/clang
[O2/nightly-20201110-1] ~ > clang -v
clang version 10.0.1 (https://github.com/llvm/llvm-project ef32c611aa214dea855364efd7ba451ec5ec3f74)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /cvmfs/alice.cern.ch/el7-x86_64/Packages/Clang/v10.0.1-17/bin-safe
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
[O2/nightly-20201110-1] ~ > which gcc
/cvmfs/alice.cern.ch/el7-x86_64/Packages/GCC-Toolchain/v7.3.0-alice1-9/bin/gcc

clang picks up the include files from the system compiler instead of GCC 7.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant