Removing rpath paths

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Removing rpath paths

Gonzalo Garramuño
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

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Removing rpath paths

Alexander Neundorf
On 2018 M10 28, Sun 10:19:58 CET Gonzalo Garramuño wrote:
...
> 3) Why does running 'readelf -d myexecutable | grep RPATH' returns nothing

only grep for "PATH", then you also get the newer RUNPATH entry.

Alex




--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Removing rpath paths

Gonzalo Garramuño

El 28/10/18 a las 13:59, Alexander Neundorf escribió:
> On 2018 M10 28, Sun 10:19:58 CET Gonzalo Garramuño wrote:
> ...
>> 3) Why does running 'readelf -d myexecutable | grep RPATH' returns nothing
> only grep for "PATH", then you also get the newer RUNPATH entry.
>
> Alex
>
Thanks.  I tried it but it also shows nothing.  In principle I don't
have any rpath.  However, in behavior I do.


--

Gonzalo Garramuño

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Removing rpath paths

Alexander Neundorf
On 2018 M10 28, Sun 14:20:40 CET you wrote:

> El 28/10/18 a las 13:59, Alexander Neundorf escribió:
> > On 2018 M10 28, Sun 10:19:58 CET Gonzalo Garramuño wrote:
> > ...
> >
> >> 3) Why does running 'readelf -d myexecutable | grep RPATH' returns
> >> nothing
> >
> > only grep for "PATH", then you also get the newer RUNPATH entry.
> >
> > Alex
>
> Thanks.  I tried it but it also shows nothing.  In principle I don't
> have any rpath.  However, in behavior I do.

well, then you do have some RPATH/RUNPATH somewhere ;-). As you say probably
in the libraries.
ld.so.conf could also contains additional search directories, but I doubt that
that's the case for you.

Alex


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Removing rpath paths

Gonzalo Garramuño

El 28/10/18 a las 18:32, Alexander Neundorf escribió:
> well, then you do have some RPATH/RUNPATH somewhere ;-). As you say probably
> in the libraries.
> ld.so.conf could also contains additional search directories, but I doubt that
> that's the case for you.

Yes, I found two libraries with rpath in them.  I used the commandline:

chrpath -d library

to remove it.  Now all is fine with the world.

--
Gonzalo Garramuño

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Removing rpath paths

Alexander Neundorf
On 2018 M10 28, Sun 18:46:24 CET you wrote:

> El 28/10/18 a las 18:32, Alexander Neundorf escribió:
> > well, then you do have some RPATH/RUNPATH somewhere ;-). As you say
> > probably in the libraries.
> > ld.so.conf could also contains additional search directories, but I doubt
> > that that's the case for you.
>
> Yes, I found two libraries with rpath in them.  I used the commandline:
>
> chrpath -d library
>
> to remove it.  Now all is fine with the world.

Ok.
Then actually you shouldn't need any RPATH settings.
The default by cmake is that you get the full RPATH in the build tree and an
empty RPATH in the install tree.

Alex



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake