* runtime link path and g++
@ 2008-07-20 12:10 Wesley Smith
2008-07-20 22:30 ` Eljay Love-Jensen
0 siblings, 1 reply; 2+ messages in thread
From: Wesley Smith @ 2008-07-20 12:10 UTC (permalink / raw)
To: GCC-help
Hi,
I'm trying to figure out how to manage shared library dependencies via
g++ on ubuntu 6.10. I have a shared library I'm building that links
against some other shared libraries. For reasons particular to my
project, I'm not putting the dependencies in /usr/lib but in a
completely different dir. I can link against them just fine using -L,
but when I run ldd on the resulting lib, it can't find them. Ideally,
I'd like to add the runtime link path aka LD_RUN_PATH "./" (i.e. path
of the lib itself). How can I specify this path to g++? I've seen -R
used in some places, but g++ doesn't understand it.
thanks,
wes
PS sorry for duplicate posting. I had forgotten to change the subject line
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: runtime link path and g++
2008-07-20 12:10 runtime link path and g++ Wesley Smith
@ 2008-07-20 22:30 ` Eljay Love-Jensen
0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2008-07-20 22:30 UTC (permalink / raw)
To: Wesley Smith, GCC-help
Hi Wes,
> How can I specify this path to g++? I've seen -R used in some places, but g++
doesn't understand it.
This is a linker issue, not so much a GCC issue. (Although it would be nice
for the GCC tool chain driver to be a little more rpath savvy across
platforms.)
Try -Wl,-rpath=/path/you/want or consider LD_LIBRARY_PATH=/path/you/want as
an environmental to your executable.
http://en.wikipedia.org/wiki/Rpath_(linking)
I'm not familiar with Ubuntu Linux, so it may do things slightly
differently.
For instance, I've heard that Ubuntu uses a different /bin/sh shell (dash
rather than bash), which results in x100 performance for their shell, and
lots of shell impedance mismatch from those who write bash-isms into what
probably should be /bin/sh clean. The caveat is: YMMV.
The rpath option has a few sharp edges. When used with relative paths, it's
a security hole for the wily and devious. If using absolute paths, it makes
the application much less mv-able.
The LD_LIBRARY_PATH option may necessitate having a user-convenience
launching script. That allows your installer to construct the launching
script with all the right baked paths for LD_LIBRARY_PATH, or for the really
tricky, the launching script may figure out those setting dynamically from
how it was launched (using $0).
HTH,
--Eljay
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-20 12:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-20 12:10 runtime link path and g++ Wesley Smith
2008-07-20 22:30 ` Eljay Love-Jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).