Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

MKL 2024.2 doesn't work with CMake

V-T
New Contributor I
1,335 Views

Consider the following contents of two files in the same directory:

  • `CMakeLists.txt`:
cmake_minimum_required(VERSION 3.12)
project(test Fortran)
set(MKL_ARCH "intel64")
set(MKL_LINK "dynamic")
set(MKL_THREADING "sequential")
set(MKL_INTERFACE "lp64")
set(MKL_MPI "intelmpi")
find_package(MKL)
add_executable(test test.f90)
target_link_libraries(test ${MKL_LIBRARIES})
  • `test.f90`:
program p
real sdot
print*,sdot(1,[1.],1,[1.],1)
end

An attempt to compile the program with the following commands in the same directory

mkdir build
cd build
FC=mpiifx cmake ..
cmake --build .

results in an error `undefined reference to `sdot_'`.

It only happens with the newest MKL version 2024.2. The older MKL version 2024.1 works properly. Did something important change in the `MKLConfig.cmake` file? Am I missing something in the `CMakeLists.txt` file?

0 Kudos
1 Solution
Ruqiu_C_Intel
Moderator
1,174 Views

Hi,


From oneMKL 2024.2, we recommend users use MKL::MKL instead of MKL_LIBRARIES in target_link_libraries(test MKL::MKL)


Please use MKL::MKL target. You can also find an example in the oneMKL CMake documentation page.


Regards,

Ruqiu



View solution in original post

0 Kudos
3 Replies
Ruqiu_C_Intel
Moderator
1,203 Views

Hello V-G,

Thank you for contacting us. We have been able to reproduce the issue and are investigating further. We will update this post once there are any improvements.


Regards,

Ruqiu




0 Kudos
Ruqiu_C_Intel
Moderator
1,175 Views

Hi,


From oneMKL 2024.2, we recommend users use MKL::MKL instead of MKL_LIBRARIES in target_link_libraries(test MKL::MKL)


Please use MKL::MKL target. You can also find an example in the oneMKL CMake documentation page.


Regards,

Ruqiu



0 Kudos
V-T
New Contributor I
1,143 Views

Thank you very much! That solves the issue.

0 Kudos
Reply