[CMake] Removing rpath paths
Gonzalo Garramuño
ggarra13 at gmail.com
Sun Oct 28 09:19:58 EDT 2018
This is probably something very simple, but I cannot find the answer. I
would like to remove all references to rpath and have my executable and
libraries be controlled by LD_LIBRARY_PATH. According to the wiki,
that's the default behavior. However, I am finding it does not work so
I set several options and nothing seems to work. I think I might have
stumbled into a bug in the libstdc++, but want to check:
Currently I have:
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# the RPATH to be used when installing
SET(CMAKE_INSTALL_RPATH "")
# don't add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
I compile my code on an Ubuntu 12.04.5 box for compatibility reasons.
When I install on an Ubuntu 16.04 which I also compile for, the error of
my executable I get is the following:
/usr/local/mrViewer-v4.3.1-Linux-64/bin/mrViewer: relocation error:
/usr/local/lib/libIlmCtl.so.1.5.0: symbol
_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE version
GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
If I remove /usr/local/lib/libIlmCtl.so.1.5.0 from its location my
executable works. I am also shipping a version of libstdc++.so.6 with
my executable, which might be a little weird.
The questions I would like some clarification are:
1) Do all the libs that my executable links to should have the rpath
removed?
2) Why when I install an executable without rpath:
Set runtime path of "/usr/local/bin/exrmultiview" to ""
I can still run it even if LD_LIBRARY_PATH is unset?
3) Why does running 'readelf -d myexecutable | grep RPATH' returns nothing
--
Gonzalo Garramuño
More information about the CMake
mailing list