In short when i try to build a application using CMake right after running source /opt/intel/oneapi/setvars.sh ia32 it does not work. I created a dockerfile to summarize my findings. It simply installs the oneAPI toolchain on a empty ubuntu base image and tries to compile a sample application. If this is a incorrect pattern for building let me know. I was following the documentation
Enable CMake with setvars.sh, oneapi-vars.sh, or vars.sh
If you are already using setvars.sh, oneapi-vars.sh, or vars.sh to initialize the build environment, then all the necessary environment variables are being set and you should be able to use CMake. For more information on these scripts, see Use the setvars and oneapi-vars Scripts with Linux*.
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/opt/intel/oneapi/compiler/2024.1/bin/icx"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /hello-world/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_84458/fast && /usr/bin/gmake -f CMakeFiles/cmTC_84458.dir/build.make CMakeFiles/cmTC_84458.dir/build
gmake[1]: Entering directory '/hello-world/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_84458.dir/testCCompiler.c.o
/opt/intel/oneapi/compiler/2024.1/bin/icx -MD -MT CMakeFiles/cmTC_84458.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_84458.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_84458.dir/testCCompiler.c.o -c /hello-world/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_84458
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_84458.dir/link.txt --verbose=1
/opt/intel/oneapi/compiler/2024.1/bin/icx CMakeFiles/cmTC_84458.dir/testCCompiler.c.o -o cmTC_84458
/usr/bin/ld: cannot find Scrt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtbeginS.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.a when searching for -lm
/usr/bin/ld: cannot find -lm: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so when searching for -lm
/usr/bin/ld: cannot find -lgcc: No such file or directory
/usr/bin/ld: cannot find -lgcc_s: No such file or directory
/usr/bin/ld: cannot find -lgcc: No such file or directory
/usr/bin/ld: cannot find -lgcc_s: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for -lc
/usr/bin/ld: cannot find -lc: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
/usr/bin/ld: cannot find -lgcc: No such file or directory
/usr/bin/ld: cannot find -lgcc_s: No such file or directory
/usr/bin/ld: cannot find crtendS.o: No such file or directory
/usr/bin/ld: cannot find crtn.o: No such file or directory
icx: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [CMakeFiles/cmTC_84458.dir/build.make:100: cmTC_84458] Error 1
gmake[1]: Leaving directory '/hello-world/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_84458/fast] Error 2
however if i replace source /opt/intel/oneapi/setvars.sh ia32 with source /opt/intel/oneapi/setvars.sh it will compile as expected and use the correct compiler.
Version
2024.1.0.596
Environment
Ubuntu 22.04
also full environment can be detailed in the dockerfile.
Steps to reproduce
given the dockerfile is present in your dir you can simply run docker build . to attempt to build it.
Observed behavior
Saw the error
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/opt/intel/oneapi/compiler/2024.1/bin/icx"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /hello-world/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_84458/fast && /usr/bin/gmake -f CMakeFiles/cmTC_84458.dir/build.make CMakeFiles/cmTC_84458.dir/build
gmake[1]: Entering directory '/hello-world/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_84458.dir/testCCompiler.c.o
/opt/intel/oneapi/compiler/2024.1/bin/icx -MD -MT CMakeFiles/cmTC_84458.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_84458.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_84458.dir/testCCompiler.c.o -c /hello-world/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_84458
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_84458.dir/link.txt --verbose=1
/opt/intel/oneapi/compiler/2024.1/bin/icx CMakeFiles/cmTC_84458.dir/testCCompiler.c.o -o cmTC_84458
/usr/bin/ld: cannot find Scrt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtbeginS.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.a when searching for -lm
/usr/bin/ld: cannot find -lm: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so when searching for -lm
/usr/bin/ld: cannot find -lgcc: No such file or directory
/usr/bin/ld: cannot find -lgcc_s: No such file or directory
/usr/bin/ld: cannot find -lgcc: No such file or directory
/usr/bin/ld: cannot find -lgcc_s: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for -lc
/usr/bin/ld: cannot find -lc: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
/usr/bin/ld: cannot find -lgcc: No such file or directory
/usr/bin/ld: cannot find -lgcc_s: No such file or directory
/usr/bin/ld: cannot find crtendS.o: No such file or directory
/usr/bin/ld: cannot find crtn.o: No such file or directory
icx: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [CMakeFiles/cmTC_84458.dir/build.make:100: cmTC_84458] Error 1
gmake[1]: Leaving directory '/hello-world/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_84458/fast] Error 2
I do believe this is related to setvars.sh not using the correct linker/glibc when ia32 is set.
Expected behavior
Dockerfile builds using ia32 as a arugment to setvars.sh
Summary
In short when i try to build a application using CMake right after running
source /opt/intel/oneapi/setvars.sh ia32
it does not work. I created a dockerfile to summarize my findings. It simply installs the oneAPI toolchain on a empty ubuntu base image and tries to compile a sample application. If this is a incorrect pattern for building let me know. I was following the documentationthis will result in the error
however if i replace
source /opt/intel/oneapi/setvars.sh ia32
withsource /opt/intel/oneapi/setvars.sh
it will compile as expected and use the correct compiler.Version
2024.1.0.596
Environment
Ubuntu 22.04
also full environment can be detailed in the dockerfile.
Steps to reproduce
given the dockerfile is present in your dir you can simply run
docker build .
to attempt to build it.Observed behavior
Saw the error
I do believe this is related to
setvars.sh
not using the correct linker/glibc when ia32 is set.Expected behavior
Dockerfile builds using ia32 as a arugment to
setvars.sh