This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: runtime link path and g++
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: Wesley Smith <wesley dot hoke at gmail dot com>, GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Sun, 20 Jul 2008 07:09:09 -0500
- Subject: Re: runtime link path and g++
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