Is there something like $ORIGIN for AIX ld?
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
Hello Volker, How about just using static linking? which also makes the executable 'independent' from other libraries. Regards Jonathan On 09/13/2012 05:34 PM, Volker Simonis wrote:
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
Hi Jonathan, that exactly how I've done it for now. Nevertheless I was interested if such a feature exists on AIX because it may useful in other use cases as well. Regards, Volker On Fri, Sep 14, 2012 at 10:49 AM, Jonathan Lu <luchsh@linux.vnet.ibm.com> wrote:
Hello Volker,
How about just using static linking? which also makes the executable 'independent' from other libraries.
Regards Jonathan
On 09/13/2012 05:34 PM, Volker Simonis wrote:
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
I have been investigating and the answer does appear to be "no" :-( On 14 Sep 2012, at 10:05, Volker Simonis <volker.simonis@gmail.com> wrote:
Hi Jonathan,
that exactly how I've done it for now. Nevertheless I was interested if such a feature exists on AIX because it may useful in other use cases as well.
Regards, Volker
On Fri, Sep 14, 2012 at 10:49 AM, Jonathan Lu <luchsh@linux.vnet.ibm.com> wrote:
Hello Volker,
How about just using static linking? which also makes the executable 'independent' from other libraries.
Regards Jonathan
On 09/13/2012 05:34 PM, Volker Simonis wrote:
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
participants (3)
-
Jonathan Lu
-
Steve Poole
-
Volker Simonis