libtool
[Top][All Lists]
Advanced

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

Question about: -R '$ORIGIN/../lib'


From: Simon Ney
Subject: Question about: -R '$ORIGIN/../lib'
Date: Fri, 16 Aug 2002 17:13:49 +0200

Hi,

will libtool support in the future "relative hardcoded runpaths" ?
This allow us to move installed "bin/*" and "lib/*" without
modification.
Or assume you install binary packages and are ask just before
installation
for the prefix directory to install into (e.g. /opt or /usr/opt ... 
that may be BASEDIR in pkgadd of solaris).
All checksums of installed package files remain the same independent of 
the installation directory.

Relative hardcoded runpaths are supported by solaris and possible
all ELF systems (?).

example how it works:
---------------------

# mkdir OBJ
# mkdir OBJ/lib
# cc -G -h libsupp.so.2 -o OBJ/lib/libsupp.so.2.1 support.o
# ln -s libsupp.so.2.1 OBJ/lib/libsupp.so.2
# ln -s libsupp.so.2 OBJ/lib/libsupp.so
# mkdir OBJ/bin
# cc -o OBJ/bin/main main.o -LOBJ/lib -R'$ORIGIN/../lib' -lsupp


in action:
----------

# ldd OBJ/bin/main       
        libsupp.so.2 =>  /tmp/libtool-question/OBJ/lib/libsupp.so.2
        ...snip...

# mv OBJ /tmp/moved

# ldd /tmp/moved/bin/main 
        libsupp.so.2 =>  /tmp/moved/lib/libsupp.so.2
        ...snip...


# dump -Lv /tmp/moved/bin/main
/tmp/moved/bin/main:

  **** DYNAMIC SECTION INFORMATION ****
.dynamic:
[INDEX] Tag         Value
[1]     NEEDED          libsupp.so.2
[2]     NEEDED          libc.so.1
        ...snip...
[5]     RUNPATH         $ORIGIN/../lib
[6]     RPATH           $ORIGIN/../lib
        ...snip...


All what have to be done is replace the absolute part with '$ORIGIN'. 
Careful observe the usage of $ORIGIN in Makefiles ( quotedstring and
dollarquote
is required ... e.g.: '$$ORIGIN' )

NOTE: this also works with:
        - Libraries hardcored to other libraries
                -R'$ORIGIN'
        - Other ABI or ISA
          example for 64bit (installed in OBJ/bin/sparcv9/main and
OBJ/lib/sparcv9/libsupp.so*):
                -R'$ORIGIN/../../lib/sparcv9'

(
 )imon

-- 
---------------------------------------------------------------------
| Simon Ney, Bischofsweg 46 60598 Frankfurt/M Tel: ++49 69 68600055 |
| Email address@hidden Fax: ++49 69 68600052 |
---------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]