Link error while building Qt 5.1.1 on Linux



  • Hi all,

    I am trying to build the 5.1.1 source tarball on Debian GNU/Linux, using g++ 4.8.2. The make step fails on a linker error:

    make[5]: Entering directory /home/sidney/MyQt/qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins/platforms/offscreen' rm -f libqoffscreen.so g++ -Wl,--no-undefined -Wl,-O1 -Wl,-rpath,/home/sidney/MyQt/root-5.1.1/lib -Wl,-rpath-link,/home/sidney/MyQt/qt-everywhere-opensource-src-5.1.1/qtbase/lib -shared -o libqoffscreen.so .obj/release-shared/main.o .obj/release-shared/qoffscreenintegration.o .obj/release-shared/qoffscreenwindow.o .obj/release-shared/qoffscreencommon.o .obj/release-shared/qoffscreenintegration_x11.o -L/home/sidney/MyQt/qt-everywhere-opensource-src-5.1.1/qtbase/lib -lQt5PlatformSupport -pthread -lgthread-2.0 -lglib-2.0 -lz -lQt5DBus -lQt5Gui -lQt5Core -lGL -lpthread .obj/release-shared/qoffscreenintegration_x11.o: In functionQOffscreenX11GLXContext::~QOffscreenX11GLXContext()':
    qoffscreenintegration_x11.cpp:(.text+0x7b): undefined reference to XDestroyWindow' .obj/release-shared/qoffscreenintegration_x11.o: In functionQOffscreenX11GLXContext::makeCurrent(QPlatformSurface*)':
    qoffscreenintegration_x11.cpp:(.text+0x129): undefined reference to XResizeWindow' qoffscreenintegration_x11.cpp:(.text+0x140): undefined reference toXSync'
    .obj/release-shared/qoffscreenintegration_x11.o: In function createDummyWindow(QOffscreenX11Info*, XVisualInfo*) [clone .isra.7]': qoffscreenintegration_x11.cpp:(.text+0x1e9): undefined reference toXCreateColormap'
    qoffscreenintegration_x11.cpp:(.text+0x276): undefined reference to XCreateWindow' qoffscreenintegration_x11.cpp:(.text+0x287): undefined reference toXFreeColormap'
    .obj/release-shared/qoffscreenintegration_x11.o: In function QOffscreenX11Connection::QOffscreenX11Connection()': qoffscreenintegration_x11.cpp:(.text+0x2e1): undefined reference toXInitThreads'
    qoffscreenintegration_x11.cpp:(.text+0x2fd): undefined reference to XOpenDisplay' .obj/release-shared/qoffscreenintegration_x11.o: In functionQOffscreenX11Connection::~QOffscreenX11Connection()':
    qoffscreenintegration_x11.cpp:(.text+0x358): undefined reference to XCloseDisplay' .obj/release-shared/qoffscreenintegration_x11.o: In functionQOffscreenX11GLXContext::QOffscreenX11GLXContext(QOffscreenX11Info*, QOpenGLContext*)':
    qoffscreenintegration_x11.cpp:(.text+0x462): undefined reference to qglx_findConfig(_XDisplay*, int, QSurfaceFormat const&, int)' qoffscreenintegration_x11.cpp:(.text+0x4b8): undefined reference toqglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat*, _XDisplay*, __GLXFBConfigRec*, __GLXcontextRec*)'
    qoffscreenintegration_x11.cpp:(.text+0x4f1): undefined reference to XFree' qoffscreenintegration_x11.cpp:(.text+0x522): undefined reference toqglx_findVisualInfo(_XDisplay*, int, QSurfaceFormat*)'
    qoffscreenintegration_x11.cpp:(.text+0x579): undefined reference to XFree' .obj/release-shared/qoffscreenintegration_x11.o: In functionQOffscreenX11Integration::createPlatformOpenGLContext(QOpenGLContext*) const':
    qoffscreenintegration_x11.cpp:(.text+0x6fd): undefined reference to XCloseDisplay' .obj/release-shared/qoffscreenintegration_x11.o: In functionQOffscreenX11Integration::~QOffscreenX11Integration()':
    qoffscreenintegration_x11.cpp:(.text._ZN24QOffscreenX11IntegrationD2Ev[_ZN24QOffscreenX11IntegrationD5Ev]+0x20): undefined reference to XCloseDisplay' .obj/release-shared/qoffscreenintegration_x11.o: In functionQOffscreenX11Integration::~QOffscreenX11Integration()':
    qoffscreenintegration_x11.cpp:(.text._ZN24QOffscreenX11IntegrationD0Ev[_ZN24QOffscreenX11IntegrationD0Ev]+0x21): undefined reference to XCloseDisplay' collect2: error: ld returned 1 exit status make[5]: *** [../../../../plugins/platforms/libqoffscreen.so] Error 1 make[5]: Leaving directory/home/sidney/MyQt/qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins/platforms/offscreen'
    make[4]: *** [sub-offscreen-make_first] Error 2
    make[4]: Leaving directory /home/sidney/MyQt/qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins/platforms' make[3]: *** [sub-platforms-make_first] Error 2 make[3]: Leaving directory/home/sidney/MyQt/qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins'
    make[2]: *** [sub-plugins-make_first] Error 2
    make[2]: Leaving directory /home/sidney/MyQt/qt-everywhere-opensource-src-5.1.1/qtbase/src' make[1]: *** [sub-src-make_first] Error 2 make[1]: Leaving directory/home/sidney/MyQt/qt-everywhere-opensource-src-5.1.1/qtbase'
    make: *** [module-qtbase-make_first] Error 2

    It seems that there is an actual dependency on Xlib that somehow fails to make it into the Makefile.

    Is there an easy fix?

    Sidney


  • Moderators

    Yes, you have missing dependencies. Please go through the list "here":http://qt-project.org/wiki/Building_Qt_5_from_Git it provides all apt-get instructions you need to run before compiling Qt.



  • Thank you, I will look into that.

    However, shouldn't the configure script discover and report missing dependencies on my system?
    As a long-time unix user, this is what I would expect.

    As it is now, I have no easy way to find out exactly which library or header file is missing. The reported link error suggests that a few very basic symbols residing in libX11 cannot be found, but the libX11-dev package is installed on my system -- it's just that -lX11 is not included in the link line for some reason.


  • Moderators

    Indeed, problems with X should have been discovered by configure. Qt does check for a ton of things in configure, though, maybe it somehow failed on your particular setup.

    I'm a bit surprised it's building the offscreen plugin. Are you passing any arcane switches to configure?



  • Hi sierdzo,

    Nothing weird, I just pass "-prefix" and "-opensource" options.

    Now that I installed a slew of xcb packages (I am puzzled why the Debian maintainers elected to split that up in 40-odd packages... but I digress), 5.1.1 builds without issue.

    Buiding 5.2.0-beta1 succeeds without a hitch, and it also built earlier when the xcb*dev packages where not installed. So it may be that this particular dependency issue was solved between 5.1 and 5.2.


  • Moderators

    Could be, 5.2 brings in really a ton of updates. Anyway, I'm glad it helped you. Happy coding :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.