LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I ensure static runpath is set for installed software (http://www.linuxquestions.org/questions/linux-software-2/how-do-i-ensure-static-runpath-is-set-for-installed-software-4175420729/)

rohit.dhaval1 08-06-2012 08:45 PM

How do I ensure static runpath is set for installed software
 
Hi,

I need to install software from a source tarball in a custom location. I need to ensure the binary is dynamically linked to set of libraries in custom location. I do not want to rely on setting LD_LIBRARY_PATH. How do I achieve it while copilation and installation

Example :

./configure --prefix=/home/user1 LDDFLAGS='-I/home/user1/lib'

Please suggest a foolproof method.

Thanks

evo2 08-06-2012 09:33 PM

Hi,

you specify static linking, but I guess you actually mean dynamic linking to libraries in a nonstandard location. You should be able to do this with ldconfig. You can add the path to /etc/ld.so.conf (or have it included) and then run ldconfig.
Check the ldconfig man page for details.

Evo2.

rohit.dhaval1 08-07-2012 12:59 PM

thank you. The situation here is,

" I have a NFS mount that will be mounted on hundreds of RHEL5 machines. I install software on an NFS volume that will be mounted on all these machines. The binaries in that NFS volume has to be self contained. It should get all required library from the NFS volume itself. How do I achieve this? Is there any parameter that I can make use of to let the binary know where it should look for required libraries? "

Adding the LD_LIBRARY_PATH to ld.so.conf definitely is a solution but, asking a user to add the custom path isn't adequate.

evo2 08-07-2012 07:57 PM

Hi,

Quote:

Originally Posted by rohit.dhaval1 (Post 4748286)
Adding the LD_LIBRARY_PATH to ld.so.conf definitely is a solution but, asking a user to add the custom path isn't adequate.

Have you considered adding the relevant path to PATH in /etc/profile on the client machines?

Evo2.

evo2 08-07-2012 07:59 PM

Hmm, regarding where the shared libraries are located, have you considered linking with the -rpath option?

Evo2.

rohit.dhaval1 08-16-2012 04:25 PM

Thank you :)

Method I used to get around the problem is,

1. While installing any software in NFS location, I would set LD_RUN_PATH in my profile. This adds to the -rpath for library/binary.
2. For already installed libraries (*.so), I would patch them with help of 'patchelf --set-rpath ' command.


All times are GMT -5. The time now is 03:12 AM.