Linking problems on FreeBSD

David Johnson david at
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/
&& /usr/local/bin/cmake -P
&& /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, -o ../../../../lib/
"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
[ 33%] Built target kcm_filetypes

This results in (reordered for readability):

# ldd
./ => /usr/X11R6/lib/ (0x28345000) => /usr/local/kde4/lib/ (0x29ef7000)
        ... => /usr/X11R6/lib/ (0x2858d000) => /usr/local/kde4/lib/ (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