Hi!
So I ran Intel oneAPI from the command prompt, and I ran CMAKE inside of this command prompt.
I used this command:
cmake -S C:/workspace/siesta.core -B C:/workspace/siesta.core/build -DCMAKE_Fortran_COMPILER=“C:/Program Files (x86)/Intel/oneAPI/compiler/2023.2.0/windows”
(I have to set the CMAKE_Fortran_COMPILER path because if I don’t, another error first appears that tells me CMAKE_Fortran_COMPILER wasn’t found).
After I did this, the following output appears in the console:
– Building for: Visual Studio 17 2022
– Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19044.
– The CXX compiler identification is MSVC 19.37.32825.0
– The C compiler identification is MSVC 19.37.32825.0
– The Fortran compiler identification is unknown
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting Fortran compiler ABI info
– Detecting Fortran compiler ABI info - failed
– Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/2023.2.0/windows
– Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/2023.2.0/windows - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/CMakeTestFortranCompiler.cmake:59 (message):
The Fortran compiler
"C:/Program Files (x86)/Intel/oneAPI/compiler/2023.2.0/windows"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/workspace/siesta.core/build/CMakeFiles/CMakeScratch/TryCompile-qdfcoq
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/devenv.com CMAKE_TRY_COMPILE.sln /build Debug /project cmTC_3620b &&
Microsoft Visual Studio 2022 Version 17.7.5.
Copyright (C) Microsoft Corp. All rights reserved.
Build started...
1>------ Build started: Project: cmTC_3620b, Configuration: Debug x64 ------
Compiling with Intelr Fortran Compiler Classic 2021.10.0 [Intel(R) 64]...
testFortranCompiler.f
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.10.0 Build 20230609_000000
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
Microsoft (R) Incremental Linker Version 14.37.32825.0
Copyright (C) Microsoft Corporation. All rights reserved.
/OUT:C:\workspace\siesta.core\build\CMakeFiles\CMakeScratch\TryCompile-qdfcoq\Debug\cmTC_3620b.exe
/VERSION:0.0
/MANIFEST
/MANIFESTFILE:cmTC_3620b.dir\Debug\cmTC_3620b.exe.intermediate.manifest
"/MANIFESTUAC:level='asInvoker' uiAccess='false'"
/SUBSYSTEM:CONSOLE
/IMPLIB:C:\workspace\siesta.core\build\CMakeFiles\CMakeScratch\TryCompile-qdfcoq\Debug\cmTC_3620b.lib
/machine:x64
cmTC_3620b.dir\Debug\testFortranCompiler.obj
cmTC_3620b.dir\Debug\cmTC_3620b.exe.embed.manifest.res
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
Build log written to "file://C:/workspace/siesta.core/build/CMakeFiles/CMakeScratch/TryCompile-qdfcoq/cmTC_3620b.dir/Debug/BuildLog.htm"
cmTC_3620b - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 8:14 AM and took 00.877 seconds ==========
Same error related to kernel32.lib
I tested using Visual Studio 2022 and building a simple Hello World program in Fortran, and the same error happens inside of VS2022:
Inside of VS2022, I fixed it in Configuration Properties > Linker > General,
by adding the path where the .lib files are located (in the ‘Additional Library Directories’ section)
(“C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64”;“C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64”):
and after building the project again in Debug x64, it succeeds
VS2022 Output window shows this message:
Build started…
1>------ Build started: Project: Console4 (IFORT), Configuration: Debug x64 ------
Linking…
Embedding manifest…
Build log written to “file://C:/Users/223080702/source/repos/Console4/Console4/x64/Debug/BuildLog.htm”
Console4 - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 8:21 AM and took 00.922 seconds ==========
So I have to replicate this solution but in CMAKE, I need to include those directories in CMAKE but I’m not sure how, I don’t want to modify the CMakeLists.txt file
Thanks