I was trying to compile and link Intel's tbb into a simple program on my mac, but I keep getting an error saying that the library was linked properly.
dyld: Library not loaded: @rpath/libtbb.dylib
Referenced from:<path>/./a.out
Reason: image not found
Trace/BPT trap: 5
The test program I used has the following code
#include <iostream>
#include <cassert>
#include <tbb/concurrent_queue.h>
int main() {
auto q = tbb::concurrent_queue<int>{};
q.push(1);
auto top_value = int{};
assert(q.try_pop(top_value));
assert(top_value == 1);
assert(q.empty());
return 0;
}
And this is how I built the library (with downloading the library included for your convenience)
curl -OL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb2017_20170118oss_src.tgz
tar -xzvf tbb2017_20170118oss_src.tgz
mv tbb2017_20170118oss tbb
rm tbb2017_20170118oss_src.tgz
cd tbb
make tbb
mv build/*_release build/tbb_release
And I tried to compile the program with this command
g+++ another.cpp -I tbb/include -L tbb/build/tbb_release -ltbb -ldl
And then on running the program I get the error above. Any ideas on how I can go about fixing this?
My compiler's version is clang-800.0.42.1
and the operating system I am running is 10.11.5
Thanks!