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