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

make problem for mkl

MXY6
初学者
2,675 次查看

Hi, recently I build a project using mkl through make, my simple CMakeLists is like this,

cmake_minimum_required(VERSION 3.14)
project(ex5 Fortran)
enable_language(Fortran)

find_package(MKL REQUIRED)
include_directories(${MKL_INCLUDE})

add_executable(ex5 main.f90)
target_link_libraries(ex5 ${MKL_LIBRARIES})
#target_link_options(ex5 PUBLIC $<LINK_ONLY:MKL::MKL>)

If I use target_link_libraries(ex5 ${MKL_LIBRARIES}), I can successfully build the project, but not for

#target_link_options(ex5 PUBLIC $<LINK_ONLY:MKL::MKL>), which shows this error,

ifort: error #10236: File not found: 'MKL::MKL'

could you help solve this? 

0 项奖励
5 回复数
JaideepK_Intel
2,645 次查看

Hi,

Thank you for posting in Intel Communities.

We are investigating your issue at our end, Could you please share the mkl version for better understanding.

 

Thanks,

Jaideep

 

0 项奖励
MXY6
初学者
2,623 次查看

Thanks for your response. My mkl version is 2021.4 for Mac os

 

0 项奖励
VidyalathaB_Intel
主持人
2,571 次查看

Hi,


Thanks for providing the details.

The issue raised by you is reproducible from our end as well.

We are looking into this issue. We will get back to you soon.


Regards,

Vidya.


0 项奖励
Khang_N_Intel
员工
2,526 次查看

Hi Meng,


We have tested with oneMKL 2021.4 and confirmed the issue. We have escalated this issue to the MKL team.


We will let you know when we have the solution for this problem.


Best regards

Khang


0 项奖励
Khang_N_Intel
员工
2,315 次查看

Hi Meng,


cmake function target_link_options inserts the target as is, target_link_libraries should be used in order to resolve MKL target correctly.

Please refer to CMakeLists.txt from oneMKL Fortran examples for the correct way how to include oneMKL to CMake project for classic Fortran API:

<install_path>/oneapi/mkl/2021.4.0/examples/examples_core_f.tgz/f/CMakeLists.txt: 

target_compile_options(${func} PUBLIC ${TEST_COPT} $<TARGET_PROPERTY:MKL::MKL,INTERFACE_COMPILE_OPTIONS>)

target_link_libraries(${func} PUBLIC ${TEST_LOPT} $<LINK_ONLY:MKL::MKL>) 


This should fix it.


Khang


0 项奖励
回复