[CMake] cmake end user vs. developer rpath handling

DIXON, MARK C. mark.c.dixon at durham.ac.uk
Thu Oct 10 07:08:16 EDT 2019


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


More information about the CMake mailing list