Message: previous - next
Month: January 2012

Linker errors in kdetoys-3.5.13

From: "E. Liddell" <ejlddll@...>
Date: Sat, 28 Jan 2012 13:59:49 -0500
I've been trying to compile (more exactly, create working Gentoo packages
for) kdetoys from the 3.5.13 version of Trinity. amor, kodo, kteatime, and
ktux all work perfectly, but eyesapplet, fifteenapplet, kmoon, kweather, 
and kworldclock all fail at the linking stage:

/bin/sh ../libtool --tag=CXX --mode=link i686-pc-linux-gnu-g++  -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -O2 -march=i686 -pipe -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION   -Wl,-O1 -Wl,--as-needed -o -rpath /usr/kde/3.5/lib/trinity -avoid-version -module -no-undefined -Wl,--no-undefined -Wl,--allow-shlib-undefined -R /usr/kde/3.5/lib -R /usr/kde/3.5/lib -R /usr/qt/3/lib  -module -L/usr/kde/3.5/lib -L/usr/qt/3/lib     eyes.lo -lkdeui 
libtool: link: i686-pc-linux-gnu-g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../crti.o /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/crtbeginS.o  .libs/eyes.o   -Wl,-rpath -Wl,/usr/kde/3.5/lib -Wl,-rpath -Wl,/usr/kde/3.5/lib -Wl,-rpath -Wl,/usr/qt/3/lib -Wl,--as-needed -L/usr/kde/3.5/lib -L/usr/qt/3/lib /usr/kde/3.5/lib/ -L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3 -L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../../i686-pc-linux-gnu/lib -L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/crtendS.o /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../crtn.o  -O2 -O2 -march=i686 -Wl,-O1 -Wl,--no-undefined -Wl,--allow-shlib-undefined   -Wl,-soname -Wl, -o .libs/
.libs/eyes.o: In function `EyesApplet::timerEvent(QTimerEvent*)':
eyes.cpp:(.text+0xc4): undefined reference to `QCursor::pos()'
eyes.cpp:(.text+0xda): undefined reference to `QWidget::mapFromGlobal(QPoint const&) const'
eyes.cpp:(.text+0xf3): undefined reference to `QWidget::update()'
.libs/eyes.o: In function `EyesApplet::resizeEvent(QResizeEvent*)':
eyes.cpp:(.text+0x140): undefined reference to `QWidget::resizeEvent(QResizeEvent*)'

I'll spare you another 200 lines of the same (the full build log for eyesapplet is attached 
if anyone wants a look).  Anyway, it looks very similar to the problem Baho Utot was 
having about a month and a half ago, with QT apparently not being linked when it should.

(Speculation follows . . .)

Now, here's the interesting bit.  Most of the applications in kdetoys are quite small,
so I figured I'd crack them open and have a look at the code.  I found out that all
the applications that failed to link had something in common: they all, at some
point, had an #include for <kpanelapplet.h>.  The applications that linked correctly
did not, as far as I could tell, make use of kpanelapplet.h.  That might or might
not be a coincidence.

It's possible that the --as-needed linker flag also plays into this somehow. Its purpose
is to strip libraries which are linked but never used by the final application they're linked
to.  However, it's been known to strip libs that *are* used from software that relies 
on implicit library inclusions.  Doing that can cause linking to fail due to missing
libraries, which again is kind of suspicious but not positive proof that it's involved.
Gentoo's package manager forces this flag on.