JDai
JDai

Reputation: 13

Program can't find libboost_program_options.so.1.47.0 at runtime

Since I don't have root permission to install Boost C++ library, I installed it under my home local. When compiling, I used: g++ -I/home/name/local/boost_1_47_0 -L/home/name/local/boost_1_47_0/stage/lib foo.cc -o foo -lboost_program_options

but at runtime, it goes: error while loading shared libraries: libboost_program_options.so.1.47.0: cannot open shared object file: No such file or directory

and ldd gives: libboost_program_options.so.1.47.0 => not found

I also tried to specify the absolute path of the library, but it doesn't work either: g++ /home/name/local/boost_1_47_0/stage/lib/libboost_program_options.so.1.47.0 -I/home/name/local/boost_1_47_0 -L/home/name/local/boost_1_47_0/stage/lib foo.cc -o foo

Upvotes: 0

Views: 6094

Answers (2)

Vorac
Vorac

Reputation: 9114

I'm a newbie, so don't take my words too seriously. Furthermore, this question is several months old and I guess solved long ago. Nevertheless, here's what I think.

You specify the library path to the linker, so the program compiles and links fine. However, when you try to execute the binary, it looks for the libs in the environment defined path.

I guess this can be fixed by typing into bash

export PATH=$PATH:path_to_your_library_folder

Best Regards Miroslav

Upvotes: 0

Kyle Lutz
Kyle Lutz

Reputation: 8036

Try using the LD_LIBRARY_PATH environment variable to instruct the run-time linker where to find the library:

export LD_LIBRARY_PATH=/home/name/local/boost_1_47_0/stage/lib

Then rerun your application.

Upvotes: 4

Related Questions