cmake end user vs. developer rpath handling

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

cmake end user vs. developer rpath handling

DIXON, MARK C.
Hi,

I install lots of software packages under Linux and, increasingly, they
use cmake instead of other methods (congratulations!)

Frustratingly for me, I seem to keep ending up in a fight with the various
developer's cmake config files over what rpath should be set, among other
things. Obviously, I think I know best, so would like to know how to win
please :)

Sometimes, this does the trick. When it does, I'm very happy:

   cmake -D CMAKE_INSTALL_RPATH="/my/rpath" source_dir

I'm currently looking at a package
(https://github.com/PointCloudLibrary/pcl) where this has no bearing on
the rpath of the installed software - I seem to get something set by the
developer.

Is there a way to reliably add to, or at least override, the developer's
rpath in any cmake-built software?

Thanks,

Mark
--

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: cmake end user vs. developer rpath handling

Zakrzewski, Jakub

________________________________________
From: CMake <[hidden email]> on behalf of DIXON, MARK C. <[hidden email]>
Sent: 08 October 2019 17:25
To: [hidden email]
Subject: [CMake] cmake end user vs. developer rpath handling

>Sometimes, this does the trick. When it does, I'm very happy:
>
>   cmake -D CMAKE_INSTALL_RPATH="/my/rpath" source_dir
>
>I'm currently looking at a package
>(https://github.com/PointCloudLibrary/pcl) where this has no bearing on
>the rpath of the installed software - I seem to get something set by the
>developer.

That "something" seems to be line 257:
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")

>Is there a way to reliably add to, or at least override, the developer's
>rpath in any cmake-built software?


Short of editing the build system scripts? I doubt...
--

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: cmake end user vs. developer rpath handling

Craig Scott-3


On Wed, Oct 9, 2019 at 5:24 PM Zakrzewski, Jakub <[hidden email]> wrote:

________________________________________
From: CMake <[hidden email]> on behalf of DIXON, MARK C. <[hidden email]>
Sent: 08 October 2019 17:25
To: [hidden email]
Subject: [CMake] cmake end user vs. developer rpath handling

>Sometimes, this does the trick. When it does, I'm very happy:
>
>   cmake -D CMAKE_INSTALL_RPATH="/my/rpath" source_dir
>
>I'm currently looking at a package
>(https://github.com/PointCloudLibrary/pcl) where this has no bearing on
>the rpath of the installed software - I seem to get something set by the
>developer.

That "something" seems to be line 257:
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")

>Is there a way to reliably add to, or at least override, the developer's
>rpath in any cmake-built software?


Short of editing the build system scripts? I doubt...

The CMAKE_INSTALL_RPATH variable is used to initialise the INSTALL_RPATH property of a target when that target is created. If you are pulling in these other projects via add_subdirectory() rather than building them standalone, you could modify the INSTALL_RPATH property of the targets you want to change from within your own top level project after add_subdirectory() returns.

--
Craig Scott
Melbourne, Australia

Get the hand-book for every CMake user: Professional CMake: A Practical Guide
Consulting services (CMake, C++, build/release processes): https://crascit.com/services

--

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: cmake end user vs. developer rpath handling

DIXON, MARK C.
In reply to this post by Zakrzewski, Jakub
On Wed, 9 Oct 2019, Zakrzewski, Jakub wrote:
...
> That "something" seems to be line 257: set(CMAKE_INSTALL_RPATH
> "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")

There's a second something that's adding boost's library directory. I'm
guessing this is maybe coming from my copy of cmake's boost detection
code.

>> Is there a way to reliably add to, or at least override, the developer's
>> rpath in any cmake-built software?
>
> Short of editing the build system scripts? I doubt...

Drat. It would be a very useful feature to have: I install a lot of
software for other people to use, and maintaining my own patches is a big
headache.

Big minus in the "comparison with GNU configure" column... setting
LD_RUN_PATH normally does the trick there.

Thanks,

Mark
--

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: cmake end user vs. developer rpath handling

DIXON, MARK C.
In reply to this post by Craig Scott-3
On Wed, 9 Oct 2019, Craig Scott wrote:
...

>>> Is there a way to reliably add to, or at least override, the developer's
>>> rpath in any cmake-built software?
>>
>> Short of editing the build system scripts? I doubt...
>
> The CMAKE_INSTALL_RPATH variable is used to initialise the INSTALL_RPATH
> property of a target when that target is created. If you are pulling in
> these other projects via add_subdirectory() rather than building them
> standalone, you could modify the INSTALL_RPATH property of the targets you
> want to change from within your own top level project after
> add_subdirectory() returns.
...

Thanks for this. My knowledge of cmake is pretty poor - I assume it uses
the same definition of target as make. So you're saying I'd need to know
the project's interesting targets first.

My choices are: maintain a patch to the software's build system files or
maintain a patch to encaspulate the software's build system files and
drive with a config file. Right?

Thanks,

Mark
--

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: cmake end user vs. developer rpath handling

remleduff
Is it not feasible to just let the build system do whatever it is going to and use "chrpath" or "patchelf" to change the rpath after-the-fact?

On Wed, Oct 9, 2019 at 11:48 AM DIXON, MARK C. <[hidden email]> wrote:
On Wed, 9 Oct 2019, Craig Scott wrote:
...
>>> Is there a way to reliably add to, or at least override, the developer's
>>> rpath in any cmake-built software?
>>
>> Short of editing the build system scripts? I doubt...
>
> The CMAKE_INSTALL_RPATH variable is used to initialise the INSTALL_RPATH
> property of a target when that target is created. If you are pulling in
> these other projects via add_subdirectory() rather than building them
> standalone, you could modify the INSTALL_RPATH property of the targets you
> want to change from within your own top level project after
> add_subdirectory() returns.
...

Thanks for this. My knowledge of cmake is pretty poor - I assume it uses
the same definition of target as make. So you're saying I'd need to know
the project's interesting targets first.

My choices are: maintain a patch to the software's build system files or
maintain a patch to encaspulate the software's build system files and
drive with a config file. Right?

Thanks,

Mark
--

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

--

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: cmake end user vs. developer rpath handling

Hendrik Sattler
In reply to this post by Zakrzewski, Jakub


Am 9. Oktober 2019 08:09:19 MESZ schrieb "Zakrzewski, Jakub"
>That "something" seems to be line 257:
>set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")

IMHO setting this to something based on CMAKE_INSTALL_PREFIX is rarely a good idea if it can be relative to the runtime path of the executable. The above makes the program not relocatable even though that's easily possible on many systems.

HS

--

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: cmake end user vs. developer rpath handling

DIXON, MARK C.
In reply to this post by remleduff
On Wed, 9 Oct 2019, Aaron Cohen wrote:

> Is it not feasible to just let the build system do whatever it is going to
> and use "chrpath" or "patchelf" to change the rpath after-the-fact?

Thanks for the suggestion, but I need to add directories to the rpath: I
believe that neither utility allows it to increase in size.

:)

Mark
--

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: cmake end user vs. developer rpath handling

Eric Noulard


Le jeu. 10 oct. 2019 à 10:36, DIXON, MARK C. <[hidden email]> a écrit :
On Wed, 9 Oct 2019, Aaron Cohen wrote:

> Is it not feasible to just let the build system do whatever it is going to
> and use "chrpath" or "patchelf" to change the rpath after-the-fact?

Thanks for the suggestion, but I need to add directories to the rpath: I
believe that neither utility allows it to increase in size.


No they can't because the maximum size is burried into the binary ELF file, 
that why CMake "reserve" some space with many ";;;" in order to replace BUILD_RPATH with INSTALL_RPATH when doing
'install'.

Note however that you should be able to "delete" RPATH: chrpath -d
and then rely on LD_LIBRARY_PATH, ld.so.config, etc....

The thing I don't quite understand why you need to replace/amend RPATH. In my (very personal) use case when I have to integrate third-party software:

1a) I compile them from source and install them using the install prefix *I need*. For cmake enabled build
     the RPATH will be updated with the one I need *during install*

2a) I use relocatable binary package (of any kind rpm, deb, or even tar.gz) for which I know that RPATH are 
      relative which can adapt to the location where I put them.
      If I cannot find a relocatable binary package then I go back to 1a).

As noted by Hendrik not every software developer are aware of the need for relocation so they may bury non-relocatable rpath in their buildsystem.

Note that there is usually 2 options for CMake buildsystem and install RPATH.
You can either:
 1. set some install RPATH (preferably in a relocatable way using $ORIGIN)
 2. don't specify install RPATH at all and let the final user/integrator setup LD_LIBRARY_PATH or ld.so.config etc...
 
This is quite well summarized here:

If the developers of the software you are using have chosen in their CMake build-system to define an install RPATH your only safe bet
is probably to build & install the software at your favorite location or propose an upstream patch for supporting unspecified RPATH.

But may be I miss something in your use case?

--
Eric

--

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: cmake end user vs. developer rpath handling

DIXON, MARK C.
On Thu, 10 Oct 2019, Eric Noulard wrote:
...
> No they can't because the maximum size is burried into the binary ELF file,
> that why CMake "reserve" some space with many ";;;" in order to replace
> BUILD_RPATH with INSTALL_RPATH when doing
> 'install'.

Hi Eric,

Interesting - any ideas on how big the padding is?


> Note however that you should be able to "delete" RPATH: chrpath -d
> and then rely on LD_LIBRARY_PATH, ld.so.config, etc....
>
> The thing I don't quite understand why you need to replace/amend RPATH. In
> my (very personal) use case when I have to integrate third-party software:

My use case is where:

- I install some software, made available to others via environment
   modules (http://modules.sourceforge.net/).

- The installed software is dynamically linked to other libraries, also
   installed via environment modules.

- I don't want to make people load modules for prerequisite libraries
   (and prerequisites for the prerequisites...) to use the software.

A complication is that I end up having to build lots of copies of the same
software but built with different prerequisites... so it has to be
automated on top of the upstream project's build system.

For applications using libraries, I've tended to use wrapper scripts as it
means fewer arguments with build systems. But for libraries using
libraries, rpath's the only real option.

My rpath can get quite long.


...
> If the developers of the software you are using have chosen in their CMake
> build-system to define an install RPATH your only safe bet
> is probably to build & install the software at your favorite location or
> propose an upstream patch for supporting unspecified RPATH.
>
> But may be I miss something in your use case?

I guess I should be proposing upstream patches but, there are so many
software projects to do this for, it has always been simpler to carry
forward a small patch or patches. Perhaps I should be a better citizen.

In this case, what feels easiest is to keep a patch commenting out the
developer's RPATH definition in CMakeLists.txt, identified by Jakub
earlier.

Cheers,

Mark
--

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: cmake end user vs. developer rpath handling

Eric Noulard


Le jeu. 10 oct. 2019 à 13:08, DIXON, MARK C. <[hidden email]> a écrit :
On Thu, 10 Oct 2019, Eric Noulard wrote:
...
> No they can't because the maximum size is burried into the binary ELF file,
> that why CMake "reserve" some space with many ";;;" in order to replace
> BUILD_RPATH with INSTALL_RPATH when doing
> 'install'.

Hi Eric,

Interesting - any ideas on how big the padding is?


Not sure, but I bet CMake is reserving as much space as needed for the forthcoming INSTALL_RPATH
(as opposed to BUILD_RPATH) he knows when specified in the CMakeLists.txt
I you rebuild the concerned from source try configuring it with a stupidly long CMAKE_INSTALL_RPATH
i.e.

cmake -DCMAKE_INSTALL_RPATH=/as/log/as/you/want/path/in/order/to/safely/patch/rpath ....

Then, you can surely have a look using  chrpath -l lib_or_exe.
 
> Note however that you should be able to "delete" RPATH: chrpath -d
> and then rely on LD_LIBRARY_PATH, ld.so.config, etc....
>
> The thing I don't quite understand why you need to replace/amend RPATH. In
> my (very personal) use case when I have to integrate third-party software:

My use case is where:

- I install some software, made available to others via environment
   modules (http://modules.sourceforge.net/).

- The installed software is dynamically linked to other libraries, also
   installed via environment modules.

- I don't want to make people load modules for prerequisite libraries
   (and prerequisites for the prerequisites...) to use the software.


ok I see, I did use modules a long time ago on some now oldish supercomputer
in order to play with various compilers of library versions.
 

A complication is that I end up having to build lots of copies of the same
software but built with different prerequisites... so it has to be
automated on top of the upstream project's build system.

For applications using libraries, I've tended to use wrapper scripts as it
means fewer arguments with build systems. But for libraries using
libraries, rpath's the only real option.

No rpath and using "only" LD_LIBRARY_PATH is not feasible in that case?
Removing rpath is easy; chrpath -d lib_or_exe
 
My rpath can get quite long.

Yes now I see why, depending on the number of  prerequisite you have and how many
modules are loaded.
  
...
> If the developers of the software you are using have chosen in their CMake
> build-system to define an install RPATH your only safe bet
> is probably to build & install the software at your favorite location or
> propose an upstream patch for supporting unspecified RPATH.
>
> But may be I miss something in your use case?

I guess I should be proposing upstream patches but, there are so many
software projects to do this for, it has always been simpler to carry
forward a small patch or patches. Perhaps I should be a better citizen.

It may not be tractable to file dozen of upstream patch and wait for feedback
but in the case the build system does not offer a way to chose install rpath content I think you are stucked
(beside remove rpath).
 

In this case, what feels easiest is to keep a patch commenting out the
developer's RPATH definition in CMakeLists.txt, identified by Jakub
earlier.

Yes I agree. However I my hypothesis of space reservation in RPATH by cmake is write
you may want to replace with something that fits your needs and not simply commenting it out.
Or may be  commenting it out and specify CMAKE_INSTALL_RPATH on the command line:

cmake -DCMAKE_INSTALL_RPATH=/as/log/as/you/want/path/in/order/to/safely/patch/rpath ....

--
Eric

--

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: cmake end user vs. developer rpath handling

Zakrzewski, Jakub
In reply to this post by Eric Noulard

From: CMake <[hidden email]> on behalf of Eric Noulard <[hidden email]>
Sent: 10 October 2019 12:05
To: DIXON, MARK C.
Cc: [hidden email]
Subject: [DKIM] Re: [CMake] cm​ake end user vs. developer rpath handling


> No they can't because the maximum size is burried into the binary ELF file, 
> that why CMake "reserve" some space with many ";;;" in order to replace BUILD_RPATH with INSTALL_RPATH when doing
> 'install'.

Interesting. 
does not really work? (An honest question)


--

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: cmake end user vs. developer rpath handling

Eric Noulard


Le jeu. 10 oct. 2019 à 14:02, Zakrzewski, Jakub <[hidden email]> a écrit :

From: CMake <[hidden email]> on behalf of Eric Noulard <[hidden email]>
Sent: 10 October 2019 12:05
To: DIXON, MARK C.
Cc: [hidden email]
Subject: [DKIM] Re: [CMake] cmake end user vs. developer rpath handling


> No they can't because the maximum size is burried into the binary ELF file, 
> that why CMake "reserve" some space with many ";;;" in order to replace BUILD_RPATH with INSTALL_RPATH when doing
> 'install'.

Interesting. 
does not really work? (An honest question)

Nope I meant that my manual page forr chrpath says:
       -r <path> | --replace <path>
              Replace current rpath or runpath setting with the path given.  The new path must be shorter or the same length as the current path.

patchelf does not seem to have this limitation.
I remember trying and being hit by that issue, but I did not tried it recently.
I'll try again and come back to you.

--
Eric

--

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: cmake end user vs. developer rpath handling

Eric Noulard


Le jeu. 10 oct. 2019 à 14:30, Eric Noulard <[hidden email]> a écrit :


Le jeu. 10 oct. 2019 à 14:02, Zakrzewski, Jakub <[hidden email]> a écrit :

From: CMake <[hidden email]> on behalf of Eric Noulard <[hidden email]>
Sent: 10 October 2019 12:05
To: DIXON, MARK C.
Cc: [hidden email]
Subject: [DKIM] Re: [CMake] cmake end user vs. developer rpath handling


> No they can't because the maximum size is burried into the binary ELF file, 
> that why CMake "reserve" some space with many ";;;" in order to replace BUILD_RPATH with INSTALL_RPATH when doing
> 'install'.

Interesting. 
does not really work? (An honest question)

Nope I meant that my manual page forr chrpath says:
       -r <path> | --replace <path>
              Replace current rpath or runpath setting with the path given.  The new path must be shorter or the same length as the current path.

patchelf does not seem to have this limitation.
I remember trying and being hit by that issue, but I did not tried it recently.
I'll try again and come back to you.

with chrpath try to replace an rpath with a longer one I get:
new rpath '/../lib:/purposely/too/long/rpath/hdsjds/dshkjhdsk/dsgdjsj' too large; maximum length 104

with patchelf is works with an intriguing warning:
warning: working around a Linux kernel bug by creating a hole of 2093056 bytes in ‘/path/to/executable’

which seems to be a resolved issue: https://github.com/NixOS/patchelf/issues/92 

after that on the modified executable,
chrpath is printing weird output when asking to read rpath.
patchelf does properly print modified rpath.


So I was wrong, thank you for your honest question Jakub.
I learned something usefull thanks to you.


--
Eric

--

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: cmake end user vs. developer rpath handling

Zakrzewski, Jakub



From: Eric Noulard <[hidden email]>
Sent: 10 October 2019 14:43
To: Zakrzewski, Jakub
Cc: [hidden email]
Subject: Re: [CMake] cmake end user vs. developer rpath handling


> So I was wrong, thank you for your honest question Jakub.
> I learned something usefull thanks to you.


​No problem, thanks for trying out.
I'd like to think that asking and answering questions (even the seemingly stupid ones) makes us learn new things.

--
Have a nice one,
Jakub

--

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: cmake end user vs. developer rpath handling

DIXON, MARK C.
In reply to this post by Eric Noulard
On Thu, 10 Oct 2019, Eric Noulard wrote:
...
> No rpath and using "only" LD_LIBRARY_PATH is not feasible in that case?
> Removing rpath is easy; chrpath -d lib_or_exe

You could but, to avoid a maintenance headache, you'd normally end up
getting the environment module to load any prereq environment modules,
which would modify LD_LIBRARY_PATH.

In either case, it'd mean unexpectedly polluting the user's environment
with things they didn't explicitly ask for, which I don't like doing.

...
> Or may be  commenting it out and specify CMAKE_INSTALL_RPATH on the command
> line:
>
> cmake
> -DCMAKE_INSTALL_RPATH=/as/log/as/you/want/path/in/order/to/safely/patch/rpath
> ....
...

Sorry - yes, I'm commenting it out and then specifying the
CMAKE_INSTALL_RPATH I want on the command line.

Best,

Mark
--

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: cmake end user vs. developer rpath handling

DIXON, MARK C.
In reply to this post by Eric Noulard
On Thu, 10 Oct 2019, Eric Noulard wrote:
...

> with patchelf is works with an intriguing warning:
> warning: working around a Linux kernel bug by creating a hole of 2093056
> bytes in ‘/path/to/executable’
>
> which seems to be a resolved issue:
> https://github.com/NixOS/patchelf/issues/92
>
> after that on the modified executable,
> chrpath is printing weird output when asking to read rpath.
> patchelf does properly print modified rpath.
>
> I think the SO article gives enough reference for this:
> https://stackoverflow.com/questions/13769141/can-i-change-rpath-in-an-already-compiled-binary
>
> So I was wrong, thank you for your honest question Jakub.
> I learned something usefull thanks to you.
...

Thanks both! Great news - being unable to grow rpath was always really
irritating.

Mark
--

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