Qt5.5 static build dlopen and -lGL compile issue when I add widgets



  • I have a statically bulding qt project that works fine. When I add QT += widgets to the pro file then I start to get the error:

    g++ -ldl -lc -static -static-libgcc -static-libstdc++ -Wl,-O1 -o ../targetRel/McpSupervisor main.o cconfig.o cconfigxml.o mcpprocessbase.o rpeprocess.o supervisor.o cipcomms.o mcpsupervisor_plugin_import.o moc_mcpprocessbase.o moc_supervisor.o moc_cipcomms.o   -L/usr/lib/i386-linux-gnu/mesa -L/usr/lib/i386-linux-gnu -lc -L/usr/local/Qt-5.5.1/lib -lQt5Xml -lQt5Widgets -L/usr/local/Qt-5.5.1/plugins/bearer -lqconnmanbearer -lqgenericbearer -lqnmbearer -lQt5Network -L/usr/local/Qt-5.5.1/plugins/platforms -lqxcb -L/usr/local/Qt-5.5.1/plugins/xcbglintegrations -lqxcb-glx-integration -lxcb-glx -lQt5XcbQpa -lX11-xcb -lXi -lxcb-render-util -lxcb-render -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms -lxcb-xkb -lQt5PlatformSupport -lfontconfig -lfreetype -lQt5DBus -lXrender -lXext -lX11 -L/usr/local/Qt-5.5.1/plugins/imageformats -lqdds -lqicns -lqico -lqjp2 -lqmng -lqtga -lqtiff -lqwbmp -lqwebp -lQt5Gui -lpng -lqtharfbuzzng -lQt5Core -lz -licui18n -licuuc -licudata -lqtpcre -lm -ldl -pthread -lgthread-2.0 -lglib-2.0 -lrt -lGL -lpthread 
    /usr/lib/i386-linux-gnu/libX11.a(CrGlCur.o): In function `open_library':
    (.text+0x33): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/bin/ld: cannot find -lGL
    /usr/lib/i386-linux-gnu/libpthread.a(lowlevellock.o): In function `__lll_lock_wait_private':
    /build/buildd/eglibc-2.19/nptl/../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:77: multiple definition of `__lll_lock_wait_private'
    /usr/lib/i386-linux-gnu/libc.a(libc-lowlevellock.o):(.text+0x0): first defined here
    /usr/lib/i386-linux-gnu/libpthread.a(lowlevellock.o): In function `__lll_unlock_wake_private':
    /build/buildd/eglibc-2.19/nptl/../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:334: multiple definition of `__lll_unlock_wake_private'
    /usr/lib/i386-linux-gnu/libc.a(libc-lowlevellock.o):(.text+0x30): first defined here
    /usr/local/Qt-5.5.1/plugins/imageformats/libqjp2.a(jas_stream.o): In function `jas_stream_tmpfile':
    jas_stream.c:(.text+0x7a4): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
    /usr/local/Qt-5.5.1/lib/libQt5Core.a(qfilesystemengine_unix.o): In function `QFileSystemEngine::resolveGroupName(unsigned int)':
    qfilesystemengine_unix.cpp:(.text+0x943): warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/i386-linux-gnu/libglib-2.0.a(libglib_2_0_la-gutils.o): In function `g_get_user_database_entry':
    (.text+0x25a): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/i386-linux-gnu/libglib-2.0.a(libglib_2_0_la-gutils.o): In function `g_get_user_database_entry':
    (.text+0xa3): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/local/Qt-5.5.1/lib/libQt5Core.a(qfilesystemengine_unix.o): In function `QFileSystemEngine::resolveUserName(unsigned int)':
    qfilesystemengine_unix.cpp:(.text+0x592): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/local/Qt-5.5.1/lib/libQt5Network.a(qhostinfo_unix.o): In function `QHostInfoAgent::fromName(QString const&)':
    qhostinfo_unix.cpp:(.text+0x580): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    collect2: error: ld returned 1 exit status
    make: *** [../targetRel/McpSupervisor] Error 1
    10:17:46: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project qtMain (kit: Qt 5.5.1 GCC 32bit Static)
    When executing step "Make"
    10:17:46: Elapsed time: 00:09.
    

    I have tried many things to fix this including:

    • Everything in here
    • Adding the following to my pro file:
      unix | win32: LIBS += -L/usr/lib/i386-linux-gnu/mesa
      unix | win32: LIBS += -L/usr/lib/i386-linux-gnu
      unix | win32: LIBS += -lc
      unix | win32: LIBS += -ldl
      QMAKE_LFLAGS += -ldl -lc
      

    I am not sure which of the two errors is more meaningful, the "can't find -lGL" or the "using 'dlopen' in statically linked..."

    any ideas?


Log in to reply
 

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