Linking problems on FreeBSD

David Johnson david at usermode.org
Mon Feb 11 00:55:43 CET 2008


On Sunday 10 February 2008, Andreas Pakulat wrote:
> On 10.02.08 13:45:10, David Johnson wrote:
> > What do I do to ensure that the KDE4 libraries (-L/usr/local/kde4/libs)
> > comes before the KDE3 libraries (-L/usr/local/lib)? Please provide me an
> > answer if you are able. I am rapidly losing my patience with cmake.
>
> How does the actual linker call look like? (make VERBOSE=1)

Here an example before any fixes:

Linking CXX shared module ../../../../lib/kcm_filetypes.so
cd
/usr/ports/x11/kdebase4/work/kdebase-4.0.1/build/apps/konqueror/settings/filetypes
&& /usr/local/bin/cmake -P
CMakeFiles/kcm_filetypes.dir/cmake_clean_target.cmake
cd
/usr/ports/x11/kdebase4/work/kdebase-4.0.1/build/apps/konqueror/settings/filetypes
&& /usr/local/bin/cmake -E cmake_link_script
CMakeFiles/kcm_filetypes.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC -O2 -pipe -march=pentium4 -Woverloaded-virtual -g -O2
-fno-reorder-blocks -fno-schedule-insns -fno-inline  -lc -shared
-Wl,-soname,kcm_filetypes.so -o ../../../../lib/kcm_filetypes.so
"CMakeFiles/kcm_filetypes.dir/kcm_filetypes_automoc.o"
"CMakeFiles/kcm_filetypes.dir/filetypesview.o"
"CMakeFiles/kcm_filetypes.dir/filetypedetails.o"
"CMakeFiles/kcm_filetypes.dir/filegroupdetails.o"
"CMakeFiles/kcm_filetypes.dir/kservicelistwidget.o"
"CMakeFiles/kcm_filetypes.dir/typeslistitem.o"
"CMakeFiles/kcm_filetypes.dir/mimetypedata.o"
"CMakeFiles/kcm_filetypes.dir/mimetypewriter.o"
"CMakeFiles/kcm_filetypes.dir/newtypedlg.o"
"CMakeFiles/kcm_filetypes.dir/kserviceselectdlg.o" -L/usr/local/lib
-L/usr/local/kde4/lib -lQtCore -lpthread -lkdecore -lkdeui -lkio -lkparts
-lQtCore -lpthread -lkdecore -lkpty -lQtXml -lQt3Support -lQtCore
-lpthread -lkdecore -lkdeui -lkio -lkfile -lkde3support -lutil -lkdecore
-lkdeui -lQtSvg -lSM -lICE -lX11 -lXext -lXft -lXau -lXdmcp -lXpm -lXtst
-lXcursor -lXfixes -lkio -lstreamanalyzer -lstreams -lfam -lXrender
-lkdecore -lQtNetwork -lz -lbz2 -lintl -lsolid -lQtCore -lpthread -lQtDBus
-lQtXml -lQtGui
/usr/local/bin/cmake -E
cmake_progress_report
/usr/ports/x11/kdebase4/work/kdebase-4.0.1/build/CMakeFiles
58
[ 33%] Built target kcm_filetypes

This results in (reordered for readability):

# ldd kcm_filetypes.so
./kcm_filetypes.so:
        libkdecore.so.6 => /usr/X11R6/lib/libkdecore.so.6 (0x28345000)
        libkdecore.so.7 => /usr/local/kde4/lib/libkdecore.so.7 (0x29ef7000)
        ...
        libkdeui.so.6 => /usr/X11R6/lib/libkdeui.so.6 (0x2858d000)
        libkdeui.so.7 => /usr/local/kde4/lib/libkdeui.so.7 (0x2a2b2000)
        ...
(the version numbers have been tweaked on our end as the KDE3 version have
wrong versions).

> Can you check wether link_directories(${KDE4_LIB_DIR}) helps? Thats
> something that is needed for CMake 2.6 support anyway and if we have a
> need for this with cmake 2.4 it may speed up getting this into svn.
>
> Andreas

Adding "link_directories(${KDE4_LIB_DIR})" to either the CMakeList.txt of
kdebase, or to the global FindKDE4Internal.cmake, fixes the problem. I'll
continue on and see if it still holds for the other modules.

Thank you!

-- 
David Johnson



More information about the Kde-buildsystem mailing list