[COLUG] Shared Library

Rob Funk rfunk at funknet.net
Fri Mar 30 13:53:24 EST 2007


Mark Erbaugh wrote:
> Is there a "correct" protocol for placing / locating shared libraries?

Lots of them.  :-)

> I'm working with python extensions to gnucash. It uses swig to build a
> library, _gnucash_.so.  This library can't find libgncqof.so.1 and
> libgw-gnc.so.0 when it loads. Both files are in /usr/local/lib. In
> addition libgw-gnc.so.0 is in /usr/lib/gnucash.
>
> The example programs use a script that sets the LD_LIBRARY_PATH
> variable (via gnucash-env), but I have read that that's the less than
> optimum solution.

Yeah, the only "right" way to use LD_LIBRARY_PATH is in a wrapper script 
around your individual program, which is really just a hack.

> One web reference I found said to use the gcc -R option in addition to
> the -L option to speficy /usr/local/lib, but my version of gcc (4.0.3)
> doesn't like the -R option.

Try -rpath instead.

> I also found a reference about creating a symlink in /usr/lib, but
> doesn't that defeat the purpose of having libraries in /usr/local/lib
> rather than in /usr/lib?

Yeah, don't do that....

Best option for your own Linux machine is to add /usr/local/lib 
to /etc/ld.so.conf, then run ldconfig.

-- 
==============================|   "A microscope locked in on one point
 Rob Funk <rfunk at funknet.net> |Never sees what kind of room that it's in"
 http://www.funknet.net/rfunk |    -- Chris Mars, "Stuck in Rewind"


More information about the colug432 mailing list