link error with gold in kdebase
Andreas Hartmetz
ahartmetz at gmail.com
Mon May 31 17:02:05 BST 2010
On Monday 31 May 2010 17:41:31 Andreas Hartmetz wrote:
> 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/nepomukfilewatch.so
> > /usr/bin/ld: warning: hidden symbol
> > 'DBusConnectionPool::threadConnection()' in
> > CMakeFiles/nepomukfilewatch.dir/__/__/common/dbusconnectionpool.o is
> > referenced by DSO /opt/kde-trunk/lib/libnepomukquery.so /usr/bin/ld:
> > error: treating warnings as errors
> > collect2: ld returned 1 exit status
> > make[2]: *** [lib/nepomukfilewatch.so] 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.
I should have read the actual error message:
gold complains about
/opt/kde-trunk/lib/libnepomukquery.so trying to use the hidden symbol
'DBusConnectionPool::threadConnection()' from someplace that is not
libnepomuk.so (where it is exported == has default visibility).
I don't know why gold tries to resolve symbols of *used* libraries at all -
possibly to prevent runtime errors. This is strange because gold also tries to
be as fast as possible.
Additionally it warns (fatally, due to --fatal-warnings) about a symbol being
hidden in one place even though it is not hidden in another. libnepomuk.so is
actually in the list of linked libraries, so gold should find it and its
DBusConnectionPool::threadConnection().
More information about the kde-core-devel
mailing list