LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   error while loading shared libraries (https://www.linuxquestions.org/questions/programming-9/error-while-loading-shared-libraries-4175415161/)

vicku 07-05-2012 10:01 PM

error while loading shared libraries
 
Hi, all,
I was trying to run a c++ program. Because I don't have root permission to install Boost C++ library, I installed it under my home local directory: /home/username/boost. The boost version I installed is boost_1_49_0. There is a .bashrc file under /home/username/ directory, I made the following settings to this .bashrc file:
export LD_LIBRARY_PATH=/home/username/boost/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/home/username/boost/lib:$LIBRARY_PATH
export C_INCLUDE_PATH=/home/username/boost/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/home/username/boost/include:$CPLUS_INCLUDE_PATH

There was a makefile, so when compiling, I used:
make -l/home/username/boost/lib

but there is an error when run the main: error while loading shared libraries: libboost_program_options.so.1.42.0: cannot open shared object file: No such file or directory

I also tried to run: export LD_LIBRARY_PATH=/home/username/boost/stage/lib, but it didn't work.
I am quite a newbie, does anyone can help me?

Thanks a lot.

pradiptart 07-06-2012 02:25 AM

Hi,

I don't know what you have in make file.Give a snap of your make file to be more clear of the question.

try this: In make file use -L(capital) in place of -l(small) to give the linker ,where to search for the libraries during runtime.

examle:
gcc -L/home/username/boost/lib <cpp file>

Thanks

sundialsvcs 07-06-2012 09:03 AM

You said that it's looking for libboost_program_options.so.1.42.0. Is this the exact library-version that is installed in the local directory?

Your program's request for the library is apparently as specific as a request can be: "version 1.42.0, please." No other version will satisfy such a request.

eantoranz 07-06-2012 02:56 PM

perhaps creating a symbolic link with the desired name of the library to the one you actually have in your system could wrap it up without breaking a lot of stuff.


All times are GMT -5. The time now is 06:44 AM.