0

I wrote the c++ project which uses tbb library. To link this library to my project I set in the project settings the paths to the library's files:

Include directories: usr/tbb/include

Libraries: usr/lib/libtbb.so, usr/lib/libtbbmalloc.so, usr/lib/libtbbmalloc_proxy.so

It worked on my PC, but when I tried to run it on cluster (via qsub), I've got error that the library path is not found. So my question is: How can I specify the path to the shared library when I execute the program on cluster? I saw the discussion here and tried to run it this way

-L/home/dinar/tbb/lib/ia32 -Wl,-rpath,/home/dinar/tbb/lib/ia32 -ltbb ./program

but it did not work.

Community
  • 1
  • 1
Dinar Abdullin
  • 165
  • 1
  • 10
  • 1
    The `-L`, `-Wl` and `-l` flags are *linker* flags, i.e. flags you use when linking your program. – Some programmer dude Oct 25 '13 at 08:52
  • Thank you for response, Joachim. What I did is: I saved the tbb package in my user directory on the cluster and tried to link the libraries to my program. But it did not work for me. Probably my executable application still keeps the old library's path (the path on my PC) which I specified to build the project. – Dinar Abdullin Oct 25 '13 at 09:02

1 Answers1

1

The environment variable you might want to set is LD_LIBRARY_PATH.

Like

$ LD_LIBRARY_PATH=/home/dinar/tbb/lib/ia32 ./program
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • I tried this too and I get error: ./program: error while loading shared libraries: libtbb.so.2: cannot open shared object file: No such file or directory – Dinar Abdullin Oct 25 '13 at 09:07
  • @DinarAbdullin And in `/home/dinar/tbb/lib/ia32` you have a file named `libtbb.so.2`? Of not do you have *any* file with a similar name (maybe more after the `.so.2`, only `.so` extension)? If the last, make a symbolic link from `libtbb.so.2.x` (or `libtbb.so`) to `libtbb.so.2`. – Some programmer dude Oct 25 '13 at 09:42
  • Joachim, in the /home/dinar/tbb/lib/ia32 I have libtbb.so and libtbb.so.2 files – Dinar Abdullin Oct 25 '13 at 11:27