KDE 4 build on FreeBSD picks up KDE 3 libs

Bartosz Fabianowski freebsd at chillt.de
Fri Sep 29 14:01:57 CEST 2006

Hi all

I have (unsuccessfully) been trying to build KDE trunk on FreeBSD for a 
few days now and believe to have located the problem. On FreeBSD, pretty 
much all libraries installed by third party applications reside in 
/usr/local/lib. This path must be included in the linker search path 
when building KDE 4 so that the third party libraries it depends on are 
found. However, /usr/local/lib is also where the KDE 3 libraries reside. 
And if this path happens to be searched before the location at which the 
KDE 4 libraries are installed, KDE 4 applications link to KDE 3 
libraries. Needless to say, this leads to broken binaries that segfault 
on start.

The linker search path is hard coded by CMake via the -rpath command 
line option. I have been able to disable this behavior by specifying 
-DCMAKE_SKIP_RPATH=YES, although I am not sure what other implications 
disabling -rpath has. Next, I set the following environment variables 
(with /kea/kde/install my KDE 4 installation prefix):


With those settings, kdelibs and kdepimlibs from KDE 4 trunk finally 
stopped linking against KDE 3 libraries. Unfortunately, it did not help 
with kdenetwork. After compiling and installing kdenetwork/kopete trunk, 
I get:

%ldd -f "%A %p\n" ~/install/lib/*.so | grep /usr/local/lib/libk
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkdecore.so.6
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkdeui.so.6
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkutils.so.3
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkparts.so.3
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkio.so.6
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkabc.so.3
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkdefx.so.6
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkwalletclient.so.1
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkdesu.so.6
/kea/kde/install/lib/libkopete.so /usr/local/lib/libkresources.so.3

By the way - the odd .so version numbers are apparently due to the 
FreeBSD port maintainers bumping them higher than the official KDE numbers.

I would appreciate some help with fixing this. The question is: How can 
I make sure that in all linker invocations, the KDE 4 installation path 
and any temporary library paths used by CMake are accessed first, before 
system paths such as /usr/local/lib and /usr/X11R6/lib?

- Bartosz

PS: I will be at aKademy till the very end on Saturday, so if anybody is 
around and would like to see the problem "live", let me know.

More information about the Kde-buildsystem mailing list