Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] TBBConfig.cmake can't find the libraries #135

Closed
ldionne opened this issue Apr 9, 2019 · 6 comments
Closed

[CMake] TBBConfig.cmake can't find the libraries #135

ldionne opened this issue Apr 9, 2019 · 6 comments

Comments

@ldionne
Copy link

ldionne commented Apr 9, 2019

Hi,

TBBConfig.cmake currently says:

# ...

get_filename_component(_tbb_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_tbb_root "${_tbb_root}" PATH)

# ...

get_filename_component(_tbb_lib_path "${_tbb_root}/lib/${_tbb_arch_subdir}/${_tbb_compiler_subdir}" ABSOLUTE)

However, this file is normally installed in:

<prefix>/lib/cmake/TBB/TBBConfig.cmake

As a result, ${CMAKE_CURRENT_LIST_FILE} is <prefix>/lib/cmake/TBB/TBBConfig.cmake, and _tbb_root is <prefix>/lib/cmake. We then try to look for the libraries in ${_tbb_root}/lib/<arch>/<compiler>, which is <prefix>/lib/cmake/lib/<arch>/<compiler>. This is incorrect, as we should be looking into <prefix>/lib/<arch>/<compiler>. The problem is that _tbb_root currently points to the root of the CMake config files installation, as opposed to the prefix where TBB was installed. Instead, we should use:

get_filename_component(_tbb_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_tbb_root "${_tbb_root}" PATH)
get_filename_component(_tbb_root "${_tbb_root}" PATH)
get_filename_component(_tbb_root "${_tbb_root}" PATH)
@AlexVeprev
Copy link
Contributor

Hi @ldionne,

Which TBBConfig.cmake do you mean?
If you mean TBBConfig.cmake from binary packages provided on the release page, then yes, it will not work if you install it in the described way. But this TBBConfig.cmake is designed to be used inside the binary package where it is provided, please see an example in README of Parallel STL sample gamma_correction.

For your case the TBBInstallConfig module (developed in scope of PRs #119, #126, #127) may be suitable, you can generate a proper TBBConfig.cmake for your TBB installation.

@ldionne
Copy link
Author

ldionne commented Apr 10, 2019

I am talking about the TBBConfig.cmake file as installed by Homebrew's tbb formula: https://github.com/Homebrew/homebrew-core/blob/master/Formula/tbb.rb

@AlexVeprev
Copy link
Contributor

@ldionne I created a PR to fix tbb formula in Homebrew: Homebrew/homebrew-core#38844

@ldionne
Copy link
Author

ldionne commented Apr 11, 2019

Thanks!

@AlexVeprev
Copy link
Contributor

The TBB formula was updated in Homebrew. Now everything works well on my machine. @ldionne, could you please check it on your side and close the issue if everything is ok?

@hjmjohnson, this might be interesting for you too.

@ldionne
Copy link
Author

ldionne commented Apr 12, 2019

Thanks, I confirmed it works as expected locally.

@tbbdev tbbdev closed this as completed May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants