Re: Linking a third-party library with my own library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rodrigo,
On Sun, Mar 08, 2009 at 02:04:54PM -0400, Rodrigo Dominguez wrote:
> g++ -shared [other switches] -L/path-to-libpapi [more switches] -lpapi -o
> mylibrary.so mylibrary.o
> The command executes without errors. However, when I run 'ldd mylibrary.o' I
> get:
> libpapi.so.3 => not found
> 
> I can see that libpapi.so.3 exists under /path-to-libpapi. Needless to say,
> when I try to load my library it complains about not being able to find
> libpapi.so.3.
> 
> What am I missing?

The compiler did its work correctly, however, as you use static linkage,
you have to tell "ldd" where to look for the library libpapi.so.3:
 Either you can do it system-wide by changing /etc/ld.so.conf (on
linux), or by defining the environment-variable LD_LIBRARY_PATH
e.g. in bash,

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path-to-libpapi ldd mylibrary.o

should work (You could also use LD_LIBRARY_PATH=/path-to-libpapi,
however I repeated the $LD_LIBRARY_PATH for the case that this variable
had already been defined...)


HTH,

Axel


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux