Skip to content

cmake: use DT_RUNPATH instead of DT_RPATH for executables

Yevhenii Kolesnikov requested to merge GL/piglit:fix/use_runpath into master

Let's say we want to substitute libGL or any other lib. This can be achieved by setting the enviroment variable LD_LIBRARY_PATH. However, DT_RPATH has a higher priority, and if libGL can be found within the directories listed in DT_RPATH, LD_LIBRARY_PATH then get's ignored.

DT_RUNPATH is exactly the same as DT_RPATH, except that it has a lower priority than LD_LIBRARY_PATH.

I've encountered this problem with several tests. DT_RPATH already contained a path to "/usr/local/lib", where a version of mesa could be found. Hence, when I tried to substitute it with my custom build, I got library mismatch resulting in segfault.

On some systems DT_RUNPATH is already being used by default, but it will be safer to explicitly specify this behavior.

Signed-off-by: Yevhenii Kolesnikov yevhenii.kolesnikov@globallogic.com

Merge request reports

Loading