Skip to content
  • Yevhenii Kolesnikov's avatar
    cmake: use DT_RUNPATH instead of DT_RPATH for executables · d8dbbd7b
    Yevhenii Kolesnikov authored
    
    
    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: default avatarYevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
    Reviewed-by: default avatarDylan Baker <dylan@pnwbakers.com>
    d8dbbd7b