I can successfully link against libawesomium-1.6.5.so
:
-L-L.
-L-lawesomium-1.6.5
-L-ldl
libawesomium-1.6.5.so
is in the same directory as my executable, now if I try to call my program (I'll call it prog for now), it exists with:
./prog: error while loading shared libraries: libawesomium-1.6.5.so.0: cannot open shared object file: No such file or directory
So I make a symlink libawesomium-1.6.5.so.0
pointing to libawesomium-1.6.5.so
, running prog
again gives me the same error, calling it with a custom LD_LIBRARY_PATH=./
works, but I wanna distribute prog
and I want the user to be able to use prog
with out root-rights (installing awesomium to /usr/lib
etc.) and without the need of setting the LD_LIBRARY_PATH
. One option would be a shell script which sets the LD_LIBRARY_PATH
, but I would prefer a different way (I also heared setting LD_LIBRARY_PATH
is a bad idea).
Furthermore, it would be great if there was no need to create the symlink to libawesomium-1.6.5.so.0
.
EDIT:
Passing -rpath=.
to the linker works! But unfortunatly awesomium can't deal with it:
/.../awesomium_test/AwesomiumProcess: error while loading shared libraries: libawesomium-1.6.5.so.0: cannot open shared object file: No such file or directory
Using -rpath and setting LD_LIBRARY_PATH from inside prog works
If you use gcc, you can pass -Wl,-rpath=lib_directory
in order to make the executable to search the libraries in the directory lib_directory
.
Moreover, this argument accepts a special value $ORIGIN
that represents the directory containing the executed program. So if you pass -Wl,-rpath='$ORIGIN'
to gcc you will be able to keep libawesomium-1.6.5.so
in the same directory than the program.