

Re: Rationale behind _cmake_skip_rpath choice in /etc/rpm/macros.cmake

Kevin Kofler wrote:
Theodore Papadopoulo wrote:
I would like to understand why the file macros.cmake as distributed in
fedora-10 defines:
%_cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=ON

Because otherwise installed binaries would end up with rpaths, even for standard library paths. (Probably a bug, I wonder if that got fixed yet.)

According to http://www.itk.org/Wiki/CMake_RPATH_handling this is now corrected since almost two years (december 2007). The %_cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=ON is a change dating in last january. I cannot explain it as
it was already cmake-2.6 as far as I can tell.
It's also quite silly to build the binaries with rpaths first and then edit them out when installing, as normally those rpaths shouldn't be needed (that's what the .shell wrappers in the uninstalled tree which set LD_LIBRARY_PATH are for).
Actually, cmake re-links libraries without rpath at installation time (according to the previous page).
Disabling the rpath made all the checks to fail, so I added a:

%define _cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=OFF

at the beginning of my specfile.

Then the testsuite for that package is broken, they need to run the .shell wrappers which CMake creates in the object tree for this purpose, not the uninstalled binaries directly. If they use CMake correctly, it'll take care of this automatically. But apparently they hardcode the binary to run without taking care of this.
The .shell wrappers are a KDE specificity. This is not standard cmake stuff. Given the above page, I believe that the solution above (undefining _cmake_skip_rpath with %{nil}) is actually the right thing to do and that the (fedora 10+) standard %cmake rpm macro is
overly restrictive in imposing the value of CMAKE_SKIP_RPATH...

I can understand that KDE may not wish to relink everything because of its size, but that's not the general case, so I'd advocate that the line (and its consequences basically reverse the commit 1.4 (rdieter 04-Jan-09)):
%_cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=ON
should disappear from /etc/rpm/macros.cmake

Note that I went on the path of adding the .shell wrappers for my project (before discovering the above web page :-( ), and
I can tell that it's not so easy...

There might be some other very good reason for keeping those lines, but I do not see it (Rex ? since you added the lines,
maybe you remember what was the motivation ?).

   Thank's a lot...

