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

MKL 2025.2 CMake does not find TBB

NickAnthony
Beginner
5,078 Views

I have both MKL and TBB installed with oneAPI 2025.2. When trying to detect MKL with `find_package(MKL CONFIG REQUIRED)` it fails because it claims that TBB cannot be found. Running the same operation with 2025.1 works without issue.

 

The difference appears to be because of line 837 of MKLConfig.cmake. In 2025.1 the line checks if TBB was not found using: `if(NOT TBB_FOUND)`. However in version 2025.2 it uses ` if(NOT TBB_tbb_FOUND)`

 

Modifying the cmake file so that line 837 matches how it was in version 2025.1 seems to fix the issue.

0 Kudos
6 Replies
Viraj_M_Intel
Employee
4,928 Views

Hi @NickAnthony 

We need some information in order to help further.

  1. Which install method did you use to install oneMKL and TBB? - oneAPI installer/apt/pip etc.
  2. Are you using Linux or Windows?
  3. How did you setup the oneAPI runtime environment? Did you use setvars.sh/bat or manually setup the PATH and/or LD_LIBRARY_PATH values?
  4. Can you list the library files inside the tbb/2025.2/lib folder?
  5. Can you also upload the TBBConfig.cmake file from tbb/2025.2/lib/cmake folder?

Thank you.

0 Kudos
NickAnthony
Beginner
4,907 Views

I am on Windows and I installed MKL and TBB with the 2025.2 oneAPI installer.

 

Although I have TBB 2022.2 installed from the oneAPI installer when I build I am actually using 2022.1 (provided by Vcpkg). So maybe it is just that the CMake file for MKL 2025.2 is incompatible with TBB 2022.1?

0 Kudos
Fengrui
Moderator
3,759 Views

It should be compatible. Could you please provide the configure output with -DCMAKE_FIND_DEBUG_MODE=on?

 

Thanks,

Fengrui

0 Kudos
Viraj_M_Intel
Employee
3,289 Views

@NickAnthony 

Just to clarify - the issue you reported:


`find_package(MKL CONFIG REQUIRED)` fails because it claims that TBB cannot be found. Running the same operation with 2025.1 works without issue.


occurs because starting 2025.2, MKLConfig.cmake forces release version of TBB to be used whereas 2025.1 MKLConfig.cmake will work with `libtbb_debug.so/a/lib/dll` as well which may provide a lower performance than the release version of TBB (libtbb.so/a/lib/dll).

 

In your case, it is possible that you have 2 installations of TBB on your machine and/or only the debug TBB is available in the shell/vcpkg environment, so @Fengrui 's approach will help debug this environment setup.

0 Kudos
jeremybouny
Beginner
893 Views

Hello,

Same issue in the context of vcpkg: I am trying to use oneMKL 2025.2.0 with oneTBB 2022.2.
By doing so, it is not able to find oneTBB cause apparently `TBB_tbb_FOUND` is not set while `TBB_FOUND` is correctly set. So, I need to patch the oneMKL CMake config file.

I also have the oneTBB debug issue but to me it is an independant issue. I also need to apply an other patch to the config file to allow finding the debug oneTBB version as expected (oneMKL is not our only dependency, we don't want it to force oneTBB in release).

0 Kudos
Viraj_M_Intel
Employee
564 Views

I understand your concern @jeremybouny , however, please note that for oneMKL to get the best performance when using TBB threading layer, it is recommended to use the release version by default. TBB_tbb_FOUND should work for the release version of TBB. Can you please check the location of your libtbb.so.12 or tbb12.dll, depending on your OS and check if both of those locations are present in CMAKE_MODULE_PATH? This will help us understand why that variable is not being set.

 

As for keeping the debug version of TBB, you can set TBB_FIND_RELEASE_ONLY = false in MKLConfig.cmake, just before the find_package(TBB...) call. It probably makes sense to add this option to MKLConfig.cmake too, to allow linking with the debug version of TBB, so I will take that feedback to my team and see what we can do.

0 Kudos
Reply