I'm trying to build some tests for threading building blocks. Unfortunately, I'm unable to configure the tbb library. The linker cannot find the library tbb. I've tried running the scripts in bin directory which has not helped. I've even tried moving the library files to /usr/local/lib/ which was again a flop. Any suggestions would be helpful.
Asked
Active
Viewed 6,091 times
2 Answers
6
Determine where you have put the tbb/lib folder, and then add the path to the library to the LD_LIBRARY_PATH environment variable, either manually or in ~/.bashrc.
Example:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/tbb/lib/intel64/gcc4.4
Then, compile the program using g++
- with the
-I
flag pointing at the header files directory - the
-L
flag pointing at the library directory - and
-ltbb
Example:
g++ program.cpp -o program -I/usr/local/lib/tbb/include -L/usr/local/lib/tbb/lib/intel64/gcc4.4 -ltbb
- with the

Community
- 1
- 1

Cosmo Harrigan
- 895
- 1
- 8
- 22
0
After building/installing and making sure that /etc/ld.so.conf has the proper listing for the directories pointing to where your libraries are stored, you might want to try and run sudo ldconfig
on the command-line and see if that changes anything.
Hope this helps,
Jason

Jason
- 31,834
- 7
- 59
- 78
-
Well that seemed to work until the linker said "error while loading shared libraries : libtbb.so.2 : cannot open shared object file : no such file or directory" Make any sense ? – Malice Apr 07 '11 at 19:58
-
That error typically means 'libtbb.so.2` a symbolic link, and `ld` is not able to follow the symbolic link to the directory it's actually contained in. You may need to manually update the symbolic link so it properly points to the correct library, and/or make sure the correct library file is in a directory that `ld` can find it in after following the symbolic link (per /etc/ld.so.conf). – Jason Apr 07 '11 at 20:01
-
Also you might be able to find some answers at this link if none of the above helps: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html – Jason Apr 07 '11 at 20:07
-
@Malice were you able to get it running? – Jason Apr 08 '11 at 17:57
-
NOP. I tried all of the above and am not getting it to run . I,ve the library in ldconfig cache but still ltbb not found – Malice Apr 10 '11 at 20:46
-
One question : How does the linker know which library (.so file to use ) when i pass it the value tbb . – Malice Apr 10 '11 at 20:56
-
BTW, I'm assuming you're on some flavor of Linux? As for the linker, when you compile with `gcc -ltbb ...`, it will look inside the directories for libtbb.so, and since that file will probably be a symbolic link, it will point ld to the proper version (in this case to libtbb.so.2). So I would again make sure that all the symbolic links are pointing in the right spot. In a worst-case scenario, get rid of the symbolic links, rename `libtbb.so.2` to `libtbb.so` and re-run `sudo ldconfig`. You could also try to manually include the entire path to `libtbb.so.2` when compiling with gcc. – Jason Apr 11 '11 at 02:24
-
Well I'm using centOS . and my libtbb.so contains just 'INPUT(libtbb.so.2)' . Is that a symbolic link ? – Malice Apr 12 '11 at 20:53
-
Yes, your libtbb.so is just a symbolic link to libtbb.so.2. So you can try deleting libtbb.so, renaming libtbb.so.2 to libtbb.so, and see if that helps. Otherwise you can actually try putting in the entire path when invoking gcc, i.e., `gcc -l/usr/lib/.../libtbb.so.2`. I'm assuming you compiled this library yourself, and it's for the correct processor/platform, right? – Jason Apr 12 '11 at 22:10
-
Actaully id id both . first i compiled from source and then i tried installing from an rpm – Malice Apr 13 '11 at 05:28
-
So I guess removing the symbolic links, renaming the libtbb.so.2 file to libtbb.so and then running `sudo ldconfig` again doesn't work? – Jason Apr 13 '11 at 11:39
-
None of them works . it's present in ldconfig cache but still ld says can't find ltbb – Malice Apr 13 '11 at 21:08
-
Are you trying to statically or dynamically link the library? Also are the permissions on the file in a state that might block you from having access to it (without being the super-user)? I'm sorry if it seems like I'm stabbing in the dark at this point, unfortunately I'm getting to the point where I'm not sure what the problem is, because typically when I've had this issue in the past, these steps have resolved the issue. – Jason Apr 14 '11 at 01:24
-
statically or dynamically - i don't know . Won't ld sort that out by itself ? and i tried running ld as super user . it's all same results – Malice Apr 16 '11 at 07:02
-
What version of `gcc` and `ld` are you using? If you' haven't upgraded them lately, and you're not on the latest version, that might be worth a try ... – Jason Apr 17 '11 at 20:58
-
well i've dropped it on cent OS for now . I'm getting it alright on centos . Got a binary package for archlinux that works perfect . – Malice Apr 26 '11 at 17:41
-
Cool, glad to hear you got it working. Sorry I couldn't offer you some better advice. – Jason Apr 26 '11 at 18:25