link error with gold in kdebase

Andreas Hartmetz ahartmetz at
Mon May 31 16:41:31 BST 2010

On Sunday 30 May 2010 16:53:38 Tobias Koenig wrote:
> Hej,
> since the recent changes to nepomuk, kdebase doesn't compile any longer
> with gold linker:
> Linking CXX shared module ../../../../lib/
> /usr/bin/ld: warning: hidden symbol
> 'DBusConnectionPool::threadConnection()' in
> CMakeFiles/nepomukfilewatch.dir/__/__/common/dbusconnectionpool.o is
> referenced by DSO /opt/kde-trunk/lib/ /usr/bin/ld:
> error: treating warnings as errors
> collect2: ld returned 1 exit status
> make[2]: *** [lib/] Error 1
> make[1]: ***
> [runtime/nepomuk/services/filewatch/CMakeFiles/nepomukfilewatch.dir/all]
> Error 2 make: *** [all] Error 2
> Any idea how to fix it?
I get the same error. DBusConnectionPool::threadConnection() exists in both 
kdelibs and kdebase, which might somehow confuse gold. The whole thread-
connection thing is a bit ugly because, AFAIK, it is a workaround for a 
libdbus bug. Due to that it is questionable if it should be part of any 
official API and of the public interface of kdelibs.
AFAICS it should be OK that the symbol is hidden in the object file 
dbusconnectionpool.o; otherwise one couldn't link together any object files 
that use each other's hidden symbols. Hidden symbols are only supposed to be 
hidden from the end product, the .so file (right?).
I'm not sure if it's OK that there are two eligible definitions of the symbol, 
the exported one from kdelibs and the hidden one from kdebase.
I have fixed the problem locally by installing the header from kdelibs that 
exports  DBusConnectionPool::threadConnection() and deleting the copy in 
kdebase. This is not generally applicable until a decision about the correct 
basic approach to the libdbus bug is made.

More information about the kde-core-devel mailing list