Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Toolchain detection logic - compiler picks up wrong gcc toolchain

DomH
Novice
362 Views

Hi, I have an AWS EC2 instance with oneAPI 2024.0.2 installed. The default gcc and g++ compilers on the system are 11.4.0. In addition, gcc 12.3.0 is installed on the system (required for the EFA packages), but g++ 12.3.0 is not. It looks like that the oneAPI C++ compiler is picking up the wrong gcc 12.3.0 toolchain, and that this is due to the underlying LLVM toolchain detection logic.

 

See

 

$ printf '#include <vector>\nvoid f() { std::vector<int> x{1,2,3}; }\n' > hello.cpp
$ icx -c hello.cpp
icx: warning: Use of 'icx' with a C++ source input file 'hello.cpp' will not link with required C++ library. Use 'icpx' for C++ source compilation and link [-Wincompatible-compiler]
hello.cpp:1:10: fatal error: 'vector' file not found
    1 | #include <vector>
      |          ^~~~~~~~
1 error generated.
$ strace -e file -o out -f icx -c hello.cpp
$ grep vector out
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/tbb/2021.11/env/../include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/mpi/2021.11/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/mkl/2024.0/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/ippcp/2021.9/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/ipp/2021.10/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/dpl/2022.3/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/dpcpp-ct/2024.0/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/dnnl/2024.0/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/dev-utilities/2024.0/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/dal/2024.0/include/dal/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/compiler/2024.0/opt/oclfpga/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/ccl/2021.11/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/lua/5.1.4.9/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "./vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/compiler/2024.0/bin/compiler/../../opt/compiler/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/opt/intel/oneapi/compiler/2024.0/lib/clang/17/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/usr/local/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/usr/include/x86_64-linux-gnu/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1779016 openat(AT_FDCWD, "/usr/include/vector", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

This file does not exist:

ubuntu@ip-10-0-1-128:~/sandpit$ ls -l /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/vector
ls: cannot access '/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/vector': No such file or directory
 

But it exists here:

ubuntu@ip-10-0-1-128:~/sandpit$ ls -l /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/11/vector
-rw-r--r-- 1 root root 4275 May 13  2023 /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/11/vector

I am getting the same error when I compile with clang-14, therefore suspecting this is a problem with the LLVM toolchain detection (but since it does affect oneAPI, I am reporting it here).

 

I don't want the Intel compilers to use the wrong gcc backend (gcc 12), because I need a consistent software environment that utilizes the default gcc compiler 11.4.0 as backend.

 

Is there a way to override the toolchain detection logic so that I can be sure it uses 11.4.0?

 

Thanks.

0 Kudos
1 Solution
DomH
Novice
358 Views

Let me note that it seems like the clang compiler that ships with oneAPI 2024.0.2 is new enough to understand the recent gcc-install-dir option:

$ icx --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/11 -c hello.cpp
$
 

 

View solution in original post

0 Kudos
1 Reply
DomH
Novice
359 Views

Let me note that it seems like the clang compiler that ships with oneAPI 2024.0.2 is new enough to understand the recent gcc-install-dir option:

$ icx --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/11 -c hello.cpp
$
 

 

0 Kudos
Reply