cmake -E cmake_symlink_library fails without error message

David Faure faure at kde.org
Mon Mar 2 19:29:41 CET 2009


Output of make:

Linking CXX shared library ../../../lib/libkonq.so
make[2]: *** [lib/libkonq.so.5.3.0] Error 1
make[1]: *** [apps/lib/konq/CMakeFiles/konq.dir/all] Error 2
make: *** [all] Error 2

Not really clear about what the problem is.
Output of VERBOSE=1 make:

Linking CXX shared library ../../../lib/libkonq.so                                                                                 
cd /d/kde/build/t/kdebase/apps/lib/konq && /d/other/inst/bin/cmake -E cmake_link_script CMakeFiles/konq.dir/link.txt --verbose=1   
/usr/lib/icecc/bin/c++  -fPIC -pipe -pedantic -Wno-long-long -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -fvisibility-inlines-hidden -O2 -g -DNDEBUG -DQT_NO_DEBUG -Wl,--enable-new-dtags -Wl,--fatal-warnings -Wl,--no-undefined -lc  -shared -Wl,-soname,libkonq.so.5 -o ../../../lib/libkonq.so.5.3.0 CMakeFiles/konq.dir/konq_automoc.o CMakeFiles/konq.dir/konq_popupmenu.o CMakeFiles/konq.dir/konq_popupmenuinformation.o CMakeFiles/konq.dir/konq_popupmenuplugin.o CMakeFiles/konq.dir/knewmenu.o CMakeFiles/konq.dir/konq_menuactions.o CMakeFiles/konq.dir/konq_copytomenu.o CMakeFiles/konq.dir/konq_operations.o CMakeFiles/konq.dir/konq_events.o CMakeFiles/konq.dir/konq_filetip.o CMakeFiles/konq.dir/konqmimedata.o CMakeFiles/konq.dir/konq_fileitemcapabilities.o -L/d/kde/inst/kde-trunk/lib -L/d/qt/4/qt-copy-trunk/lib /d/kde/inst/kde-trunk/lib/libkparts.so.4.3.0 /d/kde/inst/kde-trunk/lib/libkio.so.5.3.0 /d/qt/4/qt-copy-trunk/lib/libQtNetwork.so /d/qt/4/qt-copy-trunk/lib/libQtXml.so /d/kde/inst/kde-trunk/lib/libkdeui.so.5.3.0 /d/qt/4/qt-copy-trunk/lib/libQtSvg.so /d/kde/inst/kde-trunk/lib/libkdecore.so.5.3.0 /d/qt/4/qt-copy-trunk/lib/libQtDBus.so /d/qt/4/qt-copy-trunk/lib/libQtCore.so -lpthread /d/qt/4/qt-copy-trunk/lib/libQtGui.so -Wl,-rpath,/d/kde/inst/kde-trunk/lib:/d/qt/4/qt-copy-trunk/lib:::::::::::::::::::::::::: -Wl,-rpath-link,/d/kde/inst/kde-trunk/lib
cd /d/kde/build/t/kdebase/apps/lib/konq && /d/other/inst/bin/cmake -E cmake_symlink_library ../../../lib/libkonq.so.5.3.0 ../../../lib/libkonq.so.5 ../../../lib/libkonq.so
make[2]: *** [lib/libkonq.so.5.3.0] Error 1
make[1]: *** [apps/lib/konq/CMakeFiles/konq.dir/all] Error 2
make: *** [all] Error 2

Not better. Only stracing the "cmake -E cmake_symlink_library" call showed
what the problem was...
access("../../../lib/libkonq.so.5", R_OK) = -1 ENOENT (No such file or directory)
symlink("libkonq.so.5.3.0", "../../../lib/libkonq.so.5") = -1 EEXIST (File exists)
access("../../../lib/libkonq.so.5", R_OK) = -1 ENOENT (No such file or directory)
symlink("libkonq.so.5", "../../../lib/libkonq.so") = -1 EEXIST (File exists)

This is because
libkonq.so.5 is a broken symlink to libkonq.so.5.2.0, which doesn't exist anymore
(the version number was increased so it's 5.3.0 now).

This seems to indicate two bugs
1) cmake -E cmake_symlink_library should output an error on stderr when it fails,
so that the user is given a hint about the fact that it's the symlinking that failed
and not the actual linking with ld.
2) the symlink should be removed before being re-created; or should be tested
with lstat() rather than access(), and then removed.

-- 
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


More information about the Kde-buildsystem mailing list