Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Unable to compile with cmake


I am trying to build a simple Fortran program with oneAPI in wsl (Ubuntu 20.04). I use vscode to connect to wsl for code editing, use cmake to configure compiling, and the compiler is ifort in oneAPI.

When I configure the project, I got errors said ifort is not able to compile a simple test program. The full cmake output is:

[cmake] -- The Fortran compiler identification is Intel 2021.3.0.20210609
[cmake] -- Detecting Fortran compiler ABI info
[cmake] -- Detecting Fortran compiler ABI info - failed
[cmake] -- Check for working Fortran compiler: /opt/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/ifort
[cmake] -- Check for working Fortran compiler: /opt/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/ifort - broken
[cmake] CMake Error at /usr/local/lib/python3.8/dist-packages/cmake/data/share/cmake-3.21/Modules/CMakeTestFortranCompiler.cmake:54 (message):
[cmake]   The Fortran compiler
[cmake]     "/opt/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/ifort"
[cmake]   is not able to compile a simple test program.
[cmake]   It fails with the following output:
[cmake]     Change Dir: /home/user/programs/helloworld/build/CMakeFiles/CMakeTmp
[cmake]     Run Build Command(s):/usr/bin/make -f Makefile cmTC_04e59/fast && /usr/bin/make  -f CMakeFiles/cmTC_04e59.dir/build.make CMakeFiles/cmTC_04e59.dir/build
[cmake]     make[1]: Entering directory '/home/user/programs/helloworld/build/CMakeFiles/CMakeTmp'
[cmake]     Building Fortran object CMakeFiles/cmTC_04e59.dir/testFortranCompiler.f.o
[cmake]     /opt/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/ifort    -c /home/user/programs/helloworld/build/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTC_04e59.dir/testFortranCompiler.f.o
[cmake]     Linking Fortran executable cmTC_04e59
[cmake]     /usr/local/lib/python3.8/dist-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/cmTC_04e59.dir/link.txt --verbose=1
[cmake]     /opt/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/ifort CMakeFiles/cmTC_04e59.dir/testFortranCompiler.f.o -o cmTC_04e59 
[cmake]     ld: /opt/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/../../bin/intel64/../../lib/ error loading plugin: cannot open shared object file: No such file or directory
[cmake]     make[1]: *** [CMakeFiles/cmTC_04e59.dir/build.make:99: cmTC_04e59] Error 1
[cmake]     make[1]: Leaving directory '/home/user/programs/helloworld/build/CMakeFiles/CMakeTmp'
[cmake]     make: *** [Makefile:127: cmTC_04e59/fast] Error 2
[cmake]   CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:2 (project)
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home/user/programs/helloworld/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "/home/user/programs/helloworld/build/CMakeFiles/CMakeError.log".
My cmake version is 3.21.1,installed through pip. and ifort version is 2021.3.0.20210609.
I am very puzzled about this problem, because I tried the exact same environment and operation on other computers, but the problem could not be reproduced. On other computers, cmake and ifort work well together.
Labels (1)
0 Kudos
2 Replies
Black Belt

line 24 indicates error with file is not found. Either the environment is not setup properly or installation had a problem.

Jim Dempsey



The fact that same configuration works on other machine shows that it may be a corrupted installation on this specific machine.

The libimf library is not found in your case. Could you please check if you have it on your machine? If yes then the environment is not set correctly. Do you run file before starting the compilation?