Linking TBB using CMake and tbb_build

Linking TBB using CMake and tbb_build

I'd like to use CMake, GTest, and TBB for a project on linux, and so far I've been able to build without complaint, but the dynamic linking required by TBB has been a bit of an issue for only one of the libraries.


I'm using the CMake functions invoked like so:

    set(TBB_BUILD_PREFIX "tbb_build_prefix=tbb")

    tbb_build(TBB_ROOT ${TBB_ROOT_DIR} 

    find_package(TBB REQUIRED)

When running, I get the error:

    error while loading shared libraries: cannot open shared object file: No such file or directory


After Running `ldd <whatever_test_executable>` I get the following output =>  (0x00007fff741b9000) => /lib/x86_64-linux-gnu/ (0x00007fd99a6fd000) => /home/mrbzapp/test_proj/build/Builds/lib/tbb_debug/ (0x00007fd99a489000) => /home/mrbzapp/test_proj/build/Builds/lib/tbb_debug/ (0x00007fd99a285000) => /lib/x86_64-linux-gnu/ (0x00007fd99a081000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd999dd4000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd999a99000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd999887000) => /lib/x86_64-linux-gnu/ (0x00007fd99967f000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd9992f7000) => /lib/x86_64-linux-gnu/ (0x00007fd998fee000) => /lib/x86_64-linux-gnu/ (0x00007fd998dd7000) => /lib/x86_64-linux-gnu/ (0x00007fd998a0e000)

    /lib64/ (0x000055a935c16000) => not found => /lib/x86_64-linux-gnu/ (0x00007fd9987f2000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd9985c0000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd99839e000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd998198000) => /usr/lib/x86_64-linux-gnu/ (0x00007fd997f92000)


During build I can see that CMake (and TBB's `TBBBuild` function) is adding `/home/mrbzapp/test_proj/build/Builds/lib/tbb_debug/` to the `rpath`, and for most of the linked tbb libs they are using this path, but `` is being left out in the cold and it's bringing the whole thing down with it.


What I find completely baffling is that `` *does* exist, and exists alongside the other TBB libraries that *are* using the rpath set by TBB's functions.


What could I possibly be doing wrong, and what might I have to do in order to make sure all of these libraries are correctly linked at runtime and not just a handful?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello, M Z.

I was able to reproduce this problem, thank you for reporting it.
The problem is that can't find
As a workaround I can propose you to "source /home/mrbzapp/test_proj/build/Builds/lib/tbb_debug/ intel64" in your environment and after that execute your application.

We will notify you in this thread when we fix this problem in the Intel TBB library.

Leave a Comment

Please sign in to add a comment. Not a member? Join today