figuring out linker error on the dashboard
Alexander Neundorf
neundorf at kde.org
Wed Oct 14 22:05:31 CEST 2009
On Wednesday 14 October 2009, Robby Stephenson wrote:
> On Tuesday 13 October 2009, Alexander Neundorf wrote:
> >On Tuesday 13 October 2009, you wrote:
> >> No one else has reported a similar linking error, so I'm trying to
> >> figure out what's going on. I expect it is something that I need to fix
> >> in Tellico's cmake files
> >>
> >> Can anyone maybe suggest anything? The specific error seems to in
> >> linking to QImageBlitz, but I don't know if that's just a symptom of a
> >> different problem.
> >
> >The command which is visible on the dashboard is a compile command, not
> > the linker command, so that doesn't help a lot.
> >Do you link libimages against QImageBlitz ?
> >How do you link against libimages ?
>
> Since ld is returning the error, I assumed that was a linker problem.
Yes.
> >Linking CXX executable gcstartest
> >cd tellico/src/tests && /usr/bin/cmake -E cmake_link_script
> > CMakeFiles/gcstartest.dir/link.txt --verbose=1 /usr/local/bin/c++ -O2
>
> [snip]
Can you please post the part which you snipped ?
> > ../../../lib/libimages.a(imagefactory.o): In function
> > `Tellico::ImageFactory::createStyleImages(int, Tellico::StyleOptions
> > const&)':
> > imagefactory.cpp:(.text+0x49a4): undefined reference to
> > `Blitz::gradient(QSize const&, QColor const&, QColor const&,
> > Blitz::GradientType)'
> > imagefactory.cpp:(.text+0x4a7c): undefined
> > reference to `Blitz::unbalancedGradient(QSize const&, QColor const&,
> > QColor const&, Blitz::GradientType, int, int)'
> > collect2: ld returned 1 exit status
>
> In any case, libimages is an internal static lib. I'm not linking it
> directly to QImageBlitz, so maybe that's the problem.
Yes. Even if it's static, if it uses symbols from QImageBlitz, you
should "link" it against QImageBlitz when using cmake. This will not really
change anything in the binary static library file created, but then cmake
will know that libimage needs QImageBlitz and will link everything you link
against libimage also against QIMageBlitz.
> This is what I have
> for building the qcstartest target that is failing. All of the non variable
> libraries listed are internal static libs.
>
> set(TELLICO_TEST_LIBS
> ${QT_AND_KDECORE_LIBS}
> ${QT_QTTEST_LIBRARY}
> ${KDE4_KDEUI_LIBS}
> ${KDE4_KIO_LIBS}
> ${QIMAGEBLITZ_LIBRARIES}
> ${LIBXML2_LIBRARIES}
> ${LIBXSLT_LIBRARIES}
> ${LIBEXSLT_LIBRARIES}
> tellicotest
> collections
> translators
> utils
> core
> images
> core
> gui
> )
>
> KDE4_ADD_UNIT_TEST(gcstartest NOGUI gcstartest.cpp)
> TARGET_LINK_LIBRARIES(gcstartest translators models ${TELLICO_TEST_LIBS})
>
> At one point, I did notice weird things happened if I changed the order of
> the libraries listed in the TARGET_LINK_LIBRARIES macro. I suppose that
For static libraries the order matters.
If you have only static libs, if libA uses something from libB, then libB has
to come after libA in the link command (it doesn't matter if it already
appeared before). The linker loads the object files from libA which contain
symbols used by "somebody". If these object files reference symbols which
haven't been referenced before, it searches the libraries following libA for
these symbols.
Alex
More information about the Kde-buildsystem
mailing list