Hi all,
I’ve been trying for days in any possible way, but after the install of the new Intel oneApi HPC I’m not able to compile any Fortran (mixed C/Fortran) code from CMake.
I’m launching CMake by command prompt after having called the bat scripts from Intel (setvars) and from VS (vcvars) to have PATH in a proper state. IFort is found,
What happens is that I get “No CMAKE_Fortran_COMPILER could be found” and the CMakeError.log tells that CompilerIdFortran failed because of LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'
I tried also to put the folder containing the proper ifconsol.lib directory in PATH and also in LIBPATH and in LIB (yes, I know I’m in Windows, but I tried) but I always hit the same issue.
It sounds like something is doing (a Fortran equivalent of) #pragma comment to do “autolinking”. This still needs the library directory added, but I’m not familiar.
After days of struggling I understood what was going on…
Cmake tries to compile the CMakeFortranCompilerId that is inside <CMAKE_BINARY_DIR>\CMakeFiles\<CMakeVersion>\CompilerIdFortran, but what I didn’t know is that is not trying to compile it through a simple command line compilation, but through Visual Studio.
In fact I was perfectly able to compile the CMakeFortranCompilerId.f manually from command line, but I wasn’t when I opened the CompilerIdFortran.vfproj Visual Studio project.
The problem is caused by a wrong Visual Studio variable macro $(IFortInstallDir) that was pointing to C:\Program Files (x86)\Intel\Compiler\12.0 instead of %IFORT_COMPILER19% that for me is C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1.1\windows\;
To solve the issue you need to go inside Visual Studio>Tools>Options>Intel Compiler and Libraries>IFORT Intel Fortran Classic>Compilers>x64 and in the forms Executables, Includes, Libraries look for any instance of $(IFortInstallDir) and replace it with $(IFORT_COMPILER19).
On the contrary, if you use the new IFX instead of the standard IFORT, it seems that the paths are set correctly.
I don’t know if the $(IFortInstallDir) macro can be changed directly (I didn’t find any hint online)
I will invite Intel to double check their Visual Studio integration.
It’s nice to know that I’m not the only one to have had issues with the new oneApi, however I didn’t find the same issue in my case.
I’m up to date with CMake 3.19.4 and oneApi HPC 2682 and oneApi Base 2664.
And BTW, the reporter says:
I frequently link statically build libraries together, as linking dynamic libraries between C and Fortran is more complicated on Windows with Intel compilers
Guess, what I’m doing…
And actually I didn’t solve my problem yet. With CMake it’s now working properly but I’m encountering a lot of errors in the compilation (warnings of bad preprocessor directives, errors in finding symbols, ifx that was not found because actually the default path points to the ifort directory instead).
Anyway, CMake is now able to compile at least basic test files so I think it’s now totally on Intel+VS.
Please file an issue to track this (even if it’s not our problem, it’d be nice to have a single point for anyone else encountering the problem to add information in case we can do something eventually).