[Solved] MinGW can't find libraries when compiling static build.



  • Hello everyone. I am having a problem when trying to compile a static build for QT using MinGW.

    I think it's attempting to find the libraries that are made during the compile process, but can't find them for some reason, but I'm not sure. Can anyone help me with that?

    This is a log of the failed build:

    g++ -static -static-libgcc -Wl,--gc-sections -Wl,-s -Wl,-subsystem,console -o C:
    \qt-src\qtbase\bin\qml.exe .obj/release/main.o .obj/release/qml_qml_plugin_impor
    t.o .obj/release/qml_plugin_import.o .obj/release/qrc_qml.o .obj/release/moc_con
    f.o -LC:\openssl-1.0.2a\dist\lib -LC:/qt-src/qtbase/lib -lQt5Widgets -LC:/qt-sr
    c/qtbase/qml/QtQuick/Window.2 -lwindowplugin -LC:/qt-src/qtbase/qml/QtQuick.2 -l
    qtquick2plugin -LC:/qt-src/qtbase/plugins/qmltooling -lqmldbg_qtquick2 -lQt5Quic
    k -lqmldbg_tcp -lQt5Qml -LC:/qt-src/qtbase/plugins/bearer -lqgenericbearer -lqna
    tivewifibearer -lQt5Network -ldnsapi -lssl -lcrypto -lcrypt32 -LC:/qt-src/qtbase
    /plugins/platforms -lqwindows -lwinspool -lshlwapi -lQt5PlatformSupport -LC:/qt-
    src/qtbase/plugins/imageformats -lqdds -lqicns -lqico -lqjp2 -lqmng -lqtga -lqti
    ff -lqwbmp -lqwebp -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm -lglu32 -lopen
    gl32 -lgdi32 -lqtharfbuzzng -lQt5Core -lole32 -luuid -lws2_32 -ladvapi32 -lshell
    32 -luser32 -lkernel32 -lmpr -lz
    C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bi
    n/ld.exe: cannot find -lqdds
    C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bi
    n/ld.exe: cannot find -lqicns
    C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bi
    n/ld.exe: cannot find -lqjp2
    C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bi
    n/ld.exe: cannot find -lqmng
    C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bi
    n/ld.exe: cannot find -lqtga
    C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bi
    n/ld.exe: cannot find -lqtiff
    C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bi
    n/ld.exe: cannot find -lqwbmp
    C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bi
    n/ld.exe: cannot find -lqwebp
    collect2.exe: error: ld returned 1 exit status
    Makefile.Release:86: recipe for target 'C:\qt-src\qtbase\bin\qml.exe' failed
    mingw32-make[4]: *** [C:\qt-src\qtbase\bin\qml.exe] Error 1
    mingw32-make[4]: Leaving directory 'c:/qt-src/qtdeclarative/tools/qml'
    Makefile:34: recipe for target 'release' failed
    mingw32-make[3]: *** [release] Error 2
    mingw32-make[3]: Leaving directory 'c:/qt-src/qtdeclarative/tools/qml'
    Makefile:95: recipe for target 'sub-qml-make_first' failed
    mingw32-make[2]: *** [sub-qml-make_first] Error 2
    mingw32-make[2]: Leaving directory 'c:/qt-src/qtdeclarative/tools'
    Makefile:66: recipe for target 'sub-tools-make_first' failed
    mingw32-make[1]: *** [sub-tools-make_first] Error 2
    mingw32-make[1]: Leaving directory 'c:/qt-src/qtdeclarative'
    makefile:217: recipe for target 'module-qtdeclarative-make_first' failed
    mingw32-make: *** [module-qtdeclarative-make_first] Error 2


  • Moderators

    You may need to add -qt-libwebp and friends to configure, but a normal static build should already do that.



  • @sierdzio -qt-libwebp doesn't even exists.


  • Moderators

    Mhm, I suspected that. Definitely, the problem is with media codecs (MNG, WebP and so on). I have not encountered this. Can you tell us which Qt version are you trying to compile, what were your configure flags, and how you acquired Qt source code (because the code you get from Qt Maintenance Tool will not compile).



  • @sierdzio I'm trying to compile version 5.4.1, and I got the source from here http://www.qt.io/download-open-source/#section-2 (It's in other downloads)

    And here are my flags for configure:

    configure -static -release -opensource -opengl desktop -openssl-linked OPENSSL_LIBS="-lssl -lcrypto -lgdi32" -nomake examples


  • Moderators

    Looks fine. I do not know why are you getting this bug



  • Well, I tried compiling the source from scratch with a fresh source, and it works like a charm for some reason. Problem Solved.



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