Raspberry Pi Install Shared Library
SHARED LIBRARIES
2.3 Shared Libraries
To run a program linked with the shared version of the library the operating system must be able to locate the corresponding .so file at runtime. If the library cannot be found, the following error will occur:
$ ./a.out ./a.out: error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory To avoid this error, either modify the system dynamic linker configuration5 or define the shell variable LD_LIBRARY_PATH to include the directory where the library is installed.
For example, in the Bourne shell (/bin/sh or /bin/bash), the library search path can be set with the following commands:
$ LD_LIBRARY_PATH=/usr/local/lib $ export LD_LIBRARY_PATH $ ./example In the C-shell (/bin/csh or /bin/tcsh) the equivalent command is,
% setenv LD_LIBRARY_PATH /usr/local/lib The standard prompt for the C-shell in the example above is the percent character ‘%’, and should not be typed as part of the command.
To save retyping these commands each session they can be placed in an individual or system-wide login file.
To compile a statically linked version of the program, use the -static flag in gcc,
$ gcc -static example.o -lgsl -lgslcblas -lm
http://www.gnu.org/software/gsl/manual/html_node/Shared-Libraries.html http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/pto_gen-arm/libhuginbase.so.0.0
LD_LIBRARY_PATH
Ijust wanted to add a note for users of Ubuntu (and Debian, I guess): these systems have a security "feature" that erases LD_LIBRARY_PATH. This doesn't work:
In either /etc/environemnt or ~/.profile or ~/.bash_profile:
export LD_LIBRARY_PATH=/usr/local/boost_1_54_0/stage/lib:$LD_LIBRARY_PATH It will work for ~/.bashrc, but the path will be set just for this particular interactive shell. This means that if you invoke make from e.g. emacs or eclipse, it won't work, unless you've launched emacs from the shell and not from the launcher.
This is what worked for me:
echo -e "\n/usr/local/boost_1_54_0/stage/lib" | sudo tee -a /etc/ld.so.conf sudo ldconfig
http://stackoverflow.com/questions/4581305/error-while-loading-shared-libraries-libboost-system-so-1-45-0-cannot-open-sha?rq=1