problem with cmake 2.6RC6 and KDE 4
Brad King
brad.king at kitware.com
Mon Apr 14 15:16:02 CEST 2008
Dirk Mueller wrote:
> I've switched to cmake 2.6 for dashbot
> (http://ktown.kde.org/~dirk/dashboard/). The problem I have now is this:
>
> CMake Error at cmake/automoc/cmake_install.cmake:39 (FILE):
> file CHRPATH could not write new RPATH "/opt/testing/lib" to the file
> "/var/tmp/kdelibs-796689-build/opt/testing/bin/kde4automoc": No valid ELF
> RPATH entry exists in the file;
CMake 2.6 comes with an ELF binary parser. It is used to change the
RPATH or RUNPATH of an existing binary before installation. This is
much faster than relinking with a new RPATH as was done by CMake 2.4
(relinking is still used on non-ELF systems).
Alex originally added this feature using the "chrpath" tool. I updated
it to use a builtin parser.
> how can I get rid of that? this is KDE trunk, configured with:
>
> cmake -DKDE4_BUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=/opt/testing -DCMAKE_BUILD_TYPE=release
Add -DCMAKE_NO_BUILTIN_CHRPATH:BOOL=ON to switch back to the relinking
approach.
> a slightly related and annoying note: for some projects (e.g. strigi) it
> writes an empty rpath into the binaries during installation instead of
> removing the rpath. that breaks certain checks and is dangerous, as some
> ld.so versions interpret empty as "current directory" which allows trivially
> to hijack applications by e.g. adding a hacked libc.so.6 to the start up
> directory.
Ugh, I didn't know that about ELF linkers. IMO that's pretty stupid
because users can always put '.' in the RPATH if they want that behavior.
The builtin CHRPATH support in CMake, and AFAICT the chrpath tool
itself, just locates the RPATH string entry in the binary and overwrites
it with the new RPATH, possibly empty. It has only read support for the
DYNAMIC section and its string table.
For now I'll change CMake to use relinking when the installed rpath is
empty. Later we can look at adding support to remove the RPATH entry
from an existing binary.
Do you know any safe way to remove the RPATH entry without changing the
binary size? Is it safe to just swap the DT_RPATH or DT_RUNPATH entry
to the end of the dynamic section and replace it with DT_NULL (and
replace the rpath string with all 0 bytes)?
-Brad
More information about the Kde-buildsystem
mailing list