Important: Please read the Qt Code of Conduct -

Undef. ref. __emutls on Qt 5.15.1 static Windows

  • Hi all!

    I am building static app using Qt 5.15.1 + GStreamer 1.18.1 on Windows 10. For that purposes Qt 5.15.1 static has been built from source using Mingw 8.1.0 64bit with following configure:

    configure -static -platform win32-g++ -prefix "D:\Qt_Win\5.15.1\static_2\mingw81_64" -release -opensource -confirm-license -nomake examples -nomake tests -nomake tools -opengl desktop -no-angle -qt-sqlite -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype

    When I am trying to build my application with that Static Qt, I am getting follwong linker errors:

    D:\Qt_Win\5.15.1\static_2\mingw81_64\plugins\platforms\libqwindows.a(qwindowsservices.o):qwindowsservices.cpp:(.rdata$.refptr.__emutls_v._ZSt11__once_call[.refptr.__emutls_v._ZSt11__once_call]+0x0): undefined reference to `__emutls_v._ZSt11__once_call'
    D:\Qt_Win\5.15.1\static_2\mingw81_64\plugins\platforms\libqwindows.a(qwindowsservices.o):qwindowsservices.cpp:(.rdata$.refptr.__emutls_v._ZSt15__once_callable[.refptr.__emutls_v._ZSt15__once_callable]+0x0): undefined reference to `__emutls_v._ZSt15__once_callable'
    collect2.exe: error: ld returned 1 exit status

    Part of important qmake conf for the project

    TEMPLATE = app
    QT += widgets network multimedia xml
    QMAKE_CXXFLAGS += -O2 -Wall -Wextra -Werror=return-type -Wno-parentheses -Wno-switch -fdiagnostics-color=always -fno-diagnostics-show-caret -std=c++11 -pthread
    CONFIG += static
    win32 {
        LIBS += -LD:\gstreamer\1.0\mingw_x86_64\lib\ -lgstreamer-1.0.dll -lgobject-2.0.dll -lglib-2.0.dll -lgstvideo-1.0.dll
        INCLUDEPATH += D:\gstreamer\1.0\mingw_x86_64\include\gstreamer-1.0 D:\gstreamer\1.0\mingw_x86_64\include\glib-2.0 D:\gstreamer\1.0\mingw_x86_64\lib\glib-2.0\include
        QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++

    Some other of my applications builds fine with that Qt5.15.1 Static without any problems as well as current application builds fine with officialy downloaded Qt 5.15.1 (Dynamic).

    Will be appreciate for any help.

Log in to reply