Re: Why is LD_LIBRARY_PATH unset in FC6 and not in FC5

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

 



On Wed, 2007-06-06 at 11:37 -0600, Phil Meyer wrote:
> Matthew Saltzman wrote:

> >
> > I still don't have a good answer to the following question:
> >
> > I'm a normal user (not root) and I'm creating software for my own use.
> > I don't have access to /etc/ld.so.conf.d (and even if I did, I don't
> > want to publicize my personal lib directory).  I want to build a
> > dynamically linked binary linking to a dynamic library of my own (not in
> > the usual system paths).  I'd also like to be able to send my friends my
> > library and binary and not make them recompile it.
> >
> > If I'm not supposed to use LD_LIBRARY_PATH to let the binary know where
> > to find my personal libs, what's the best other way to do it?
> >
> >
> >   
> 
> You can embed the library path into the resulting binary.  That way the 
> linker will search that path each time the binary is executed.
> 
> This is done (used to be done? ) by setting LD_RUN_PATH before doing the 
> compile.
> 
> This environment variable may have changed names with newer versions of 
> gcc.  According to the gnu doc that I listed, the new fangled way is 
> with LIBRARY_PATH.  Note the absence of LD,
> 
> So it would go like this:
> 
> $ LIBRARY_PATH=/home/myhome/libs
> $ export LIBRARY_PATH
> 
> $ gcc -o myprog myproc.c -lmylib
> 
> Now anyone can run myprog and the loader linker will look in 
> /home/myhome/libs every time it is executed.
> 
> No need for LD_LIBRARY_PATH, and no need for LIBRARY_PATH after the build.
> 
> Hope this helps, and I hope this is accurate.  It used to be using 
> LD_RUN_PATH, maybe it still is, I have not tested the 'new' way.

That solves the problem for me, but my friend may not be able to put the
library in the same location on his machine.  Static linking isn't a
solution, because my friend may want to link his own code with his copy
of my dynamic lib.

> 
> 
> 
-- 
                Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux