/opt/intel/oneapi/tbb/latest/env/vars.sh
doesn't setup CMake variables in a way that will lead to TBB being successfully detected.
In the latest OneAPI Debian packages (as of today 2020-12-21), the TBB shared libraries are located in /opt/intel/oneapi/tbb/2021.1.1/lib/intel64/gcc4.8/
*.
/opt/intel/oneapi/tbb/latest/env/vars.sh
sets CMAKE_PREFIX_PATH
to ${TBBROOT}
, aka /opt/intel/oneapi/tbb/2021.1.1
. That's not helpful - here's how CMake's find_library
uses CMAKE_PREFIX_PATH
:
[...] 2. Search paths specified in cmake-specific environment variables. These are intended to be set in the user’s shell configuration, and therefore use the host’s native path separator (
;
on Windows and:
on UNIX). This can be skipped ifNO_CMAKE_ENVIRONMENT_PATH
is passed or by setting theCMAKE_FIND_USE_CMAKE_ENVIRONMENT_PAT
toFALSE
.
<prefix>/lib/<arch>
ifCMAKE_LIBRARY_ARCHITECTURE
is set, and<prefix>/lib
for each<prefix>
inCMAKE_PREFIX_PATH
CMAKE_LIBRARY_PATH
CMAKE_FRAMEWORK_PATH
By setting CMAKE_PREFIX_PATH
to /opt/intel/oneapi/tbb/2021.1.1
, you're telling CMake to search in /opt/intel/oneapi/tbb/2021.1.1/lib
, but TBB is not there.
Instead you shoulkd probably be setting CMAKE_LIBRARY_PATH
, which should be a semicolon or colon separated list of paths. The OneAPI vars.sh
scripts already correctly setup LIBRARY_PATH
in this format - for example, for me, it's:
LIBRARY_PATH=/opt/intel/oneapi/tbb/2021.1.1/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/compiler/2021.1.1/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/2021.1.1/linux/lib:/usr/local/cuda/lib64/stubs
which, as you can see, has the correct path to the TBB libraries in there.
If you just set CMAKE_LIBRARY_PATH
to the same thing, everything would work fine.
Alternatively, it would be very nice if y'all could provide a CMake package configuration and find script for TBB. @allisonvacanti from my team can give you some advice on how to do that.
- The TBB libraries being in a directory called
gcc4.8
seems odd in and of itself. Why aren't they just inlib/intel64
? That's what a lot of tools expect.