Operating System - Linux
1756571 Members
2672 Online
108848 Solutions
New Discussion

linking using $ORIGIN or +origin

 
bsergean
Occasional Contributor

linking using $ORIGIN or +origin

Hi all,

(posted to HP-UX -> general but no news, so here may be the right place).

I'm trying to link my binaries so that I don't have to rely on SHLIB_PATH and a wrapper script at startup, My binaries depends on a lot of shared objects that will be at a defined path in the install tree.

bash-3.00$ cd myInstallTree
bash-3.00$ tree ./
./
|-- bin
| `-- mybin
`-- lib
|-- 3rdparty
| `-- libz.sl
`-- libA.sl

Under Linux and Solaris you can use the $ORIGIN variable, giving this to the linker

-Wl,-rpath -Wl,\$$ORIGIN/../lib # (from a Linux Makefile)

I saw in the HP-UX ld manpage that a +origin option is available, but I cannot figure out how to use it according to my needs.

Any ideas ?

Thanks,
Benjamin.

ps:
It's on HP-UX 11.00.
1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: linking using $ORIGIN or +origin

>(posted to HP-UX -> general).

You may want to subscribe to the HPUX-DEVTOOLS mailing list:
http://h21007.www2.hp.com/dspp/comm/comm_Community_Home_IDX/1,1273,,00.html

Looking at the man page it suggests that $ORIGIN be used instead of +origin. It has -Wl,+B,$ORIGIN and:

For more details on $ORIGIN, use the +help option or see the HP-UX Linker and Libraries User's Guide.
http://www.docs.hp.com/en/B2355-90730/B2355-90730.html