# CMake cannot find ifconsol.lib

**URL:** https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668
**Category:** Usage
**Tags:** comp:intel
**Created:** [February 1, 2021, 3:13pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668 "2021-02-01T15:13:43Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![dariomangoni](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dariomangoni/32/1160_2.png) [@dariomangoni](https://discourse.cmake.org/u/dariomangoni)
#### Post date: [February 1, 2021, 3:13pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/1 "2021-02-01T15:13:43Z")

</div>

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.

I’m really going crazy.

Thanks in advance for any help.

Dario

(cannot add attachment because I’m a new user)

```
Compiling the Fortran compiler identification source file "CMakeFortranCompilerId.F" failed.
Compiler:  
Build flags: 
Id flags: 
The output was:
1
Microsoft Visual Studio 2019 Version 16.8.4.
Copyright (C) Microsoft Corp. All rights reserved.
Package 'IFLangServicePackage' failed to load.
Package 'IFLangServicePackage' failed to load.
1>------ Build started: Project: CompilerIdFortran, Configuration: Debug x64 ------
1>Compiling with Intel© Fortran Compiler Classic 2021.1.1 [Intel(R) 64]...
1>CMakeFortranCompilerId.F
1>Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Build 20201112_000000
1>Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
1>Linking...
1>Microsoft (R) Incremental Linker Version 14.28.29336.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>/OUT:.\CompilerIdFortran.exe
1>/INCREMENTAL:NO
1>/MANIFEST
1>/MANIFESTFILE:Debug\CompilerIdFortran.exe.intermediate.manifest
1>"/MANIFESTUAC:level='asInvoker' uiAccess='false'"
1>/DEBUG
1>/PDB:C:\workspace\libraries\MUMPS_5.1.2_build\CMakeFiles\3.19.3\CompilerIdFortran\CompilerIdFortran.pdb
1>/SUBSYSTEM:CONSOLE
1>/IMPLIB:C:\workspace\libraries\MUMPS_5.1.2_build\CMakeFiles\3.19.3\CompilerIdFortran\CompilerIdFortran.lib
1>Debug\CMakeFortranCompilerId.obj
1>LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'
1>
1>Build log written to "file://C:\workspace\libraries\MUMPS_5.1.2_build\CMakeFiles\3.19.3\CompilerIdFortran\Debug\BuildLog.htm"
1>CompilerIdFortran - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 1, 2021, 3:28pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/2 "2021-02-01T15:28:32Z")

</div>

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.

@brad.king

---

<div class="post-metadata">

### Author: ![dariomangoni](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dariomangoni/32/1160_2.png) [@dariomangoni](https://discourse.cmake.org/u/dariomangoni)
#### Post date: [February 1, 2021, 8:58pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/3 "2021-02-01T20:58:08Z")

</div>

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.

 ![image](https://discourse.cmake.org/uploads/default/original/2X/c/c29715e825249f9b1b437b38fb9549cc8adbcdef.png)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 1, 2021, 9:30pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/4 "2021-02-01T21:30:42Z")

</div>

Ah, oneAPI had some fixes that were made in 3.19.2 (for Windows; Linux is 3.19.3). Does using those versions work? See [this thread](https://discourse.cmake.org/t/intel-oneapi-gold-release-broken-linux-windows/2340).

---

<div class="post-metadata">

### Author: ![dariomangoni](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dariomangoni/32/1160_2.png) [@dariomangoni](https://discourse.cmake.org/u/dariomangoni)
#### Post date: [February 1, 2021, 9:44pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/5 "2021-02-01T21:44:53Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 1, 2021, 9:49pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/6 "2021-02-01T21:49:09Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![dariomangoni](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dariomangoni/32/1160_2.png) [@dariomangoni](https://discourse.cmake.org/u/dariomangoni)
#### Post date: [February 1, 2021, 9:51pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/7 "2021-02-01T21:51:40Z")

</div>

Do you mean an issue on Kitware/CMake GitHub or are you talking about Intel forum?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 1, 2021, 9:59pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/8 "2021-02-01T21:59:49Z")

</div>

Ah sorry, on CMake’s [issue tracker](https://gitlab.kitware.com/cmake/cmake/issues).

---

<div class="post-metadata">

### Author: ![dariomangoni](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dariomangoni/32/1160_2.png) [@dariomangoni](https://discourse.cmake.org/u/dariomangoni)
#### Post date: [February 1, 2021, 10:16pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668/9 "2021-02-01T22:16:18Z")

</div>

I just realized that a similar thread was already there. I don’t know why I didn’t find it before… and I was exactly looking at GitLab…

I added a comment [to this thread](https://gitlab.kitware.com/cmake/cmake/-/issues/17765#note_895951) since it matches the problem that I had.

I could also open a new one if you think it’s better
