News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

[Linux] Error while loading shared libraries

Started by moritz.pflanzer, December 31, 2010, 04:52:15 PM

Previous topic - Next topic

moritz.pflanzer

Hello,
when I try to start my console application from the terminal I get the following error:
"error while loading shared libraries: libboost_thread.so.1.45.0: cannot open shared object file: No such file or directory"
But it occurs only when I try to start the apllication from terminal. In Code::Blocks it is working properly.
I compiled the application with the following options:
- Linker settings -> Link libraries: "boost_thread"
- Search Directories -> Linker: "../boost/boost_1_45_0/stage/lib"
- The working directory is set to "."

My dir tree looks like:
./programm
./programm/boost/boost_1_45_0/stage/lib/
   -> libboost_thread.so (which is a link to libboost_thread.so.1.45.0)
   -> libboost_thread.so.1.45.0
./projectdir/
./projectdir/bin/Release

Also if I copy the two library files to the "Release" dir I'am getting the error.

I hope that's enough information otherwise please ask.

oBFusCATed

Set the LD_LIBARY_PATH appropriately or read in the linker's manual about rpath
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

moritz.pflanzer

Thank you oBFusCATed. I'm going to use "rpath" since it seems as if many people don't recommend LD_LIBRARY_PATH.

Jenna

Quote from: moritz.pflanzer on January 03, 2011, 12:51:01 AM
Thank you oBFusCATed. I'm going to use "rpath" since it seems as if many people don't recommend LD_LIBRARY_PATH.
rpath means hard-coding library paths, that should not be done on linux (and on other systems), because it can break the executable , if the libraries are moved for any reasons.
If the libraries are set up correctly (should be done by the build-system or the package maintainer) it's normally not needed to do so.

THe method described here: http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux#Resolving_issues is preferred, if you do not want to use LD_LIBRARY_PATH.