Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set RunPath of a binary?

Tags:

linux

gcc

linker

There are countless threads describing what is RPATH, RUNPATH and LD_LIBRARY_PATH and how they interact in order to resolve libraries' location.

To set RPATH use gcc options:

-Wl,-rpath,/path/to/dir

To set LD_LIBRARY_PATH use:

export LD_LIBRARY_PATH= <path of lib>

What I cannot find is how to set RUNPATH?

like image 909
Kam Avatar asked Nov 15 '14 06:11

Kam


1 Answers

Seems runpath is set to the -Wl value if you pass --enable-new-dtags

http://blog.tremily.us/posts/rpath/

This links seems to suggest the difference in use for rpath and runpath seems to be their order in the search list:

http://en.wikipedia.org/wiki/Rpath

like image 156
Marco van de Voort Avatar answered Sep 20 '22 00:09

Marco van de Voort