I'm trying to develope an application by using TBB for multicore parallelization on Ubuntu 7.10. But I've some problems with TBB on my Ubuntu machine. I've used Intel C++ compiler 10.1.015 and TBB 2.0.018 for my application. When I tried to release my application I got the following error : " cannot find -ltbb". I've already set up the environment variables for TBB by adding the lines from "tbbvars.sh" into the "/etc/bash.bashrc". I also copied libtbb.so, libtbb_debug.so, libtbbmalloc.so and libtbbmalloc_debug.so files to the following directories /lib, /usr/lib and/usr/local/lib. But still get the error message. In my application MKL 10.0.1.014 library is also used. But no problems with MKL.
Can anyone help me to solve this problem?
Thanks a lot!
It certainly seems to be some kind of disconnect. Can we eliminate the simple stuff first? "Release your application..." Do you mean you've installed your program somewhere publicly after having been able to run it with TBB linking in a development directory? Cannot find -ltbb seems more suggestive of the link stage.
I've have trouble in the past with presuming that environmental settings I've made in some set of configuration files actually make it to my destination environment, based on the vagaries of how some combination of bash filenames and extensions get interpreted by the shell as it initializes. I've taken a habit of tagging each of the herd with statements equivalent to "export MY_ETCBASH=1" "export MY_HOMEBASHRC=1" ... just to verify that the configuration files I think are getting run actually are getting run.
I don't use Ubuntu so I can't speak specifically of it, but on my FC6 system as with many Linux flavors, you can install new library paths into /etc/ld.so.conf.d (my FC6 machine has entries for mysql and Qt).
Thank you for your reply. But I still have the link error with TBB.
Actually my application is kind of simulation software. I've used TBB to speed up the simulation. I need to develop my application in order to use on both Window and Linux Os. I've alreadyreleased my application for window version. Butfor the linux version, I have such kind of link error with TBB.
As your suggestion, I've added the library paths to /etc/ld.so.conf.d/libc.conf, but I still have the link error "ld : cannot find -ltbb". I also added tbbvars.sh into /etc/bash.bashrc. Moreover I also copied the files libtbb.so, libtbbmalloc.so, libtbb_debug.so, libtbbmalloc_debug.so into the folders /lib, /usr/lib, and /usr/local/lib. But these could not solve the problem.
ActuallyI have no experience with all kinds of Linux OS. This is the first time I've everused Linux OS, Ubuntu 7.10. So I don't know where I should put the statements like "exportMY_ETCBASH=1" "export MY_HOMEBASHRC=1" into which file? For my Ubuntu machine, I've used /etc/bash.bashrc file to put the setting for TBB (tbbvars.sh) , MKL (mklvars32.sh) , etc. Can you please explain me more detail?
Then I found a blog "Globalized TBB Environment Configuration on Linux" written by "Kevin Farnham" at Intel Software Network. I followed all the instructions in his post, but my problem still could not be solved. At the "Comments" section for this post, I found a comment from Clay Breshears (Intel)asking that "Does this all work if I use the Intel Compiler? I've been having linking problems with an installation when I use icc, but don't have the same problems with gcc.". So I've tried one or two TBB examples provided by Intel, I found these examples worked on my machine. But in these examples, GCC compiler is used instead of Intel compiler. So I'm thinking that the problem would be the Intel Compiler orTBB link problem with Intel compiler. As I've said, I'm just a beginner in both TBB and Linux, I'm not sure what the problem would be. I hope someone could point me out to solve my problem.
Thanks a lot!
I might be wrong but TBB2.0.018 package should be for the mac and 2.0.020 package should be for the linux(es). Could you try 2.0.020 package or download bits from http://www.threadingbuildingblocks.org/ver.php?fid=107page.
BTW I've just posted the latest stable bits on http://www.threadingbuildingblocks.org/ver.php?fid=111page.
Its still not clear to me whether to categorize your question as a DEVELOPMENT issue or a DEPLOYMENT issue. Normally tweaking things in /etc are for more than a personal impact. But the repeated reference to ltbb leads me to a link error, not a load error.
Theres lots of resources in print and on the web regarding Linux development, but Ill share with you a bit of the infrastructure Ive been using for my current blog series. I needed access to Intel TBB features not in any published binary so I needed to build my own an link them in. I didnt want to have to construct a Makefile from scratch (theres probably some tool for automating it) so I just built a batch file:
gcc -g -o nested_dbg -I../../TBB/tbb20_20080408oss_src/include -I/usr/include -L ../../TBB/tbb20_20080408oss_src/build/l
inux_em64t_gcc_cc4.1.2_libc2.5_kernel2.6.18_debug -ltbb_debug -lstdc++ nested.cpp
gcc -o nested -I../../TBB/tbb20_20080408oss_src/include -I/usr/include -L ../../TBB/tbb20_20080408oss_src/build/linux_em
64t_gcc_cc4.1.2_libc2.5_kernel2.6.18_release -ltbb -lstdc++ nested.cpp
This sets the minimum required environment to link from my project directory to the location of the Intel TBB build that I did, linking both include files and library objects with the usual syntax to specify include paths and library paths. These set the library for the build but not necessarily for the parent shell. Failing to set LD_LIBRARY_PATH would result in an error like this:
./nested: error while loading shared libraries: libtbb.so: cannot open shared object file: No such file or directory
Thats easily corrected by issuing the correct export line for optimized or debug in the parent shell. Ah, but there was an issue of using the Intel compiler. I experimented with that, sourced an environment for the Intel compiler (/opt/intel/cce/10.1.013/bin/iccvars.sh or whatever), then ran the script again and got:
./nested: error while loading shared libraries: libcxaguard.so.5: cannot open shared object file: No such file or directory
This is because I managed to lose the link to the compiler library in my LD_LIBRARY_PATH because of an inadvertent sourcing of one of the export lines above. The solution to that was just to add the compiler library to the build script.
Regarding my export MY_ETCBASH suggestion, if you read the initialization section of the bash man page youll see several files that may be read depending on particular conditions, and after too many assumptions proved wrong, I decided to add these notations to the heads of several of these files, just so I could check whether the shell I was running at the moment actually had the benefit of a particular file. I might add export MY_ETCBASHRC=1 to the start of /etc/bashrc and then be able to check whether MY_ETCBASHRC is defined in a particular shell. This became especially handy when I built a multi-environment shell initialization to handle different machine architectures and *NIX flavors, including MKS and SFU on Windows plus Linux.
This is an interesting piece of knowledge; thank you for posting it.
If -fast implies -static, then -g might have nothing to do with the issue, as TBB does not provide static libraries for release condiguration either.