Is there something like $ORIGIN for AIX ld?

Volker Simonis volker.simonis at gmail.com
Thu Sep 13 02:34:59 PDT 2012


Hi,

in OpenJDK 7 the java executable is by default linked against
libjli.so which is located under jre/lib/amd64/jli/libjli.so.
libjli.so is found by the runtime linker because the java executable
was linked with a corresponding
"-Wl,-rpath,$ORIGIN/../jre/lib/amd64/jli" option which allows the
executable to find the library relatively to its own location.

My question is, if there exists a similar construct for AIX?

The same question (in some more detail) has been already asked some
time ago in a IBM developerworks forum
(http://www.ibm.com/developerworks/forums/message.jspa?messageID=14036328)
and because I'm just to lazy to reformulate it with my own words,
here's it is:

"
...
I want to make my executable, which uses shared libraries, independent
of any shared library path setings (LIBBPATH ...). Instead the shared
libraries should
always be searched for in the directory in which the executable resides.
This is to ease installation and to ensure, my app always picks up the
right libraries.

On Platforms like linux, hpux and solaris this can easily be handeled
by placing $ORIGIN in the link line (e.g. on linux: gcc -Wl,-rpath,$ORIGIN ...
or on hpux: ld +b \$ORIGIN ... or on solaris: ld -R \$ORIGIN ...)

By doing this and placing all shared libraries that my executbale
needs in the same
directory as the executbale itself, the shared libraries are always found from
that location relative to the location of the executable in the filesystem.
This works because $ORIGIN is resolved by the dynamic loader not at linktime but
at execution time. It is resolved to the directory in which the
executbale resides.

I could not find anything like this for AIX.
Is there such a mechanism on AIX as well?
...
"

Regards,
Volker


More information about the ppc-aix-port-dev mailing list