Skip to content

cmake: workaround oneAPI problem with -DMKL_WITH_TBB=ON#19451

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
alalek:cmake_mkl_tbb_oneapi_workaround
Feb 5, 2021
Merged

cmake: workaround oneAPI problem with -DMKL_WITH_TBB=ON#19451
opencv-pushbot merged 1 commit intoopencv:masterfrom
alalek:cmake_mkl_tbb_oneapi_workaround

Conversation

@alalek
Copy link
Copy Markdown
Member

@alalek alalek commented Feb 2, 2021

continues #19384 #19447

Workarounds oneMKL with oneTBB problem from oneAPI on Windows.

LINK : fatal error LNK1104: cannot open file 'tbb12.lib'

Usage steps:

call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
cmake -G "Visual Studio 16 2019" -A x64 ../opencv -DCMAKE_BUILD_TYPE=Release -DWITH_TBB=ON -DMKL_WITH_TBB=ON
build_image:Custom Win=oneapi_mkl_with_tbb-2021.1.1

Comment on lines +72 to +76
# MSBuild drops content of 'LIB' environment variable,
# so pass TBB library directory through `link_directories()`
get_filename_component(_tbb_lib_dir "${_tbb_lib}" DIRECTORY)
message(STATUS "MKL: adding '${_tbb_lib_dir}' to link directories (workaround DEFAULTLIB issue)")
link_directories("${_tbb_lib_dir}")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observations:

  • direct invocation of link.exe/cl.exe works fine (with setvars.bat)
  • invocation through MSBuild doesn't work

Reason: MSBuild drops/replaces some environment variables, including LIB which points to TBB's library directory (specified in setvars).

@opencv-pushbot opencv-pushbot merged commit 2a2e4e7 into opencv:master Feb 5, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants