Important: Please read the Qt Code of Conduct -

(Solved) Building Qt5 with mingw64 on windows 7 64Bit

  • Hi,

    I ran in a problem when trying to build Qt5 on windows7 64 bit machine with the latest mingw64 setup.

    • I downloaded the latest mingw build from here "" and installed it in C:\ming64 and
      also added the path to the enviroment PATH variable.
    • I downloaded the latest source with GIT in C:\qt5
    • I ran cmd and changed directory to c:\qt5
    • I ran configure -developer-build -opensource -nomake examples -nomake tests -opengl desktop
    • I immediately got the error message libgcc_s_dw2-1.dll not found.

    In the mingw64\bin directory there is no libgcc_s_dw2-1.dll, there is only a libgcc_s_sjlj.dll.

    I also tried first to run configure with the 32 bit mingw installation and after configure switching to 64 bit, but qmake is built by configure with the 32 bit mingw dlls and will cause the same error when starting mingw32-make.

    Is there a way to built Qt5 with the 64 bit mingw installation?


  • Moderators

    Hmm... looks like MinGW-Builds only provides the Dwarf version on 32-bit Windows (see vs )

    You could try a different flavour of MinGW (MinGW-w64 or TDM-GCC); they might have libgcc_s_dw2-1.dll

  • Thanks for the answer, so I tried with mingw-w64 with a personal built from rubenvb which also only contains the sjlj dll.
    Then I tried with TDM-GCC which contains the dw2 dll, but configure crashes just after starting with the following output:

    @c:\qt5>configure -developer-build -opensource -nomake examples -nomake tests -op
    engl desktop

    • c:/qt5/qtbase/configure -developer-build -opensource -nomake examples -nomake
      tests -opengl desktop
      Can't spawn "c:/qt5/qtbase/configure": No error at c:\qt5\configure line 77.
      *** qtbase/configure exited with non-zero status.@

  • Moderators

    Did you clean everything before re-configuring?

    Also try invoking configure.exe explicitly (as opposed to the configure script)

  • Yes I ran mingw32-make clean before re-configuring.

    The git repo does not contain configure.exe in the main directory, only the perl script. I have already installed a version 4.8.3 on this machine, can I use the configure.exe from this version?

  • some more info:
    When I try to start the configure.exe from qt5 which is in c:/qt5/qtbase I get the following message from winows:

    Problemereignisname: APPCRASH
    Anwendungsname: configure.exe
    Anwendungszeitstempel: 50b381cc
    Fehlermodulname: libstdc++-6.dll
    Fehlermodulzeitstempel: 5054e689
    Ausnahmecode: c0000096
    Ausnahmeoffset: 000952c1
    Betriebsystemversion: 6.1.7601.
    Gebietsschema-ID: 1031
    Zusatzinformation 1: 0a9e
    Zusatzinformation 2: 0a9e372d3b4ad19135b953a78882e789
    Zusatzinformation 3: 0a9e
    Zusatzinformation 4: 0a9e372d3b4ad19135b953a78882e789@

    unfortunately in German...

    The configure.exe from my Qt 4.8.3 installation is not working at all, just gives me the list with possible parameters.

  • Moderators

    Sorry, my mistake; there is no configure.exe for Qt 5. The old configure.exe is incompatible with Qt 5 because the structure has changed completely.

    Which shell are you using? I managed to build Qt 5 (Edit: 32-bit) using cmd.exe

    C:\qt5>configure.bat -developer-build -opensource -nomake examples -nomake tests -opengl desktop

  • Yes I'm using the standard windows cmd.exe. And I tried exactly the command you suggest. But I received the error message as described above.
    Do you really use 64 bit mingw? If so, which package do you use?

  • Moderators

    Wow, I'm quite terrible tonight... I should've mentioned that I have a 32-bit system >_> I used the 32-bit Dwarf version of MinGW-Builds.

    The "Can't spawn" message seems to be from Perl. I'm not quite sure what's happening on your system, but "this page": says:
    [quote]To properly configure and build Qt 5 from source you also need Perl (>=5.14)


    Make sure that Perl is added to the path in front of git since that ships an outdated version (Perl 5.8), which will cause the scripts to fail.[/quote]Does this apply to you?

  • Yes Perl is in the PATH and when I enter perl -v in cmd.exe I get version 5.16.1 which should be OK.
    After all, again I do not have any problems when I try this with a 32 Bit mingw version, only with the 64 Bit version. The 32 Bit version configures and compiles without problems. But I have a 64 Bit operation system and so I would like to build also programs for 64 Bit.

    OK, I assume the following and I hope that there is somebody out there who can confirm this or have another solution.

    • configure.exe is build with 32 bit mingw and so needs the 32 bit dlls from mingw. This leads in an error when trying to run configure with the 64 bit mingw dlls.
    • running configure.exe with 32 bit dlls will build qmake also with 32 bit dlls. This means also running qmake later with 64 bit dlls will also create an error (I already tried this). So it is not possible to built Qt5 with 64 bit dlls.
    • Currently I do not see any possibility to use qt together with mingw 64 bit

  • Moderators

    I'm out of ideas here, sorry. Hopefully someone with the relevant experience will see this thread

    People have managed to use MinGW to build 64-bit Qt 5 before:

    All the best

  • [quote author="mbreier" date="1354019930"]Yes I ran mingw32-make clean before re-configuring.[/quote]Use <code>git submodule foreach --recursive git clean dfx</code> instead.
    [quote author="mbreier" date="1354019930"]The git repo does not contain configure.exe in the main directory, only the perl script.[/quote]<code>configure</code> can be found <code>qtbase/tools/configure</code>, and it is built the first time it is invoked.
    [quote author="mbreier" date="1354019930"]I have already installed a version 4.8.3 on this machine, can I use the configure.exe from this version?[/quote]No, you can't.

    Make sure that your source tree (see #1) and your environment is clean (no <code>QTDIR</code> is set, no other Qt in <code>PATH</code>) before (re-)building Qt.

  • Cool, this worked out of the box.

    Thanx a lot

  • Hello,

    I am also trying to build QT5 (5.0.1 from git) with mingw64 (I have previously succeeded to build it with msvc2012 in 64bits but I need to deploy with mingw64).

    I first run "qt5_tool -c" to clean everything, then I run configure with the following options:
    -opensource -nomake examples -nomake tests -nomake demos -c++11 -opengl desktop -no-icu -platform win32-g++

    The configure phase seems to run smoothly, but I run into this error when executing mingw32-make:


    cd qtbase\ && ( if not exist Makefile C:\qt5\qt5\qtbase\bin\qmake C:\qt5\qt5\qtb
    ase\ -o Makefile ) && mingw32-make -f Makefile
    mingw32-make[1]: Entering directory 'C:/qt5/qt5/qtbase'
    cd src\ && ( if not exist Makefile C:\qt5\qt5\qtbase\bin\qmake C:\qt5\qt5\qtbase
    \src\ -o Makefile ) && mingw32-make -f Makefile
    mingw32-make[2]: Entering directory 'C:/qt5/qt5/qtbase/src'
    cd tools\ && ( if not exist Makefile C:\qt5\qt5\qtbase\bin\qmake C:\qt5\qt5\qtba
    se\src\tools\ -o Makefile ) && mingw32-make -f Makefile
    mingw32-make[3]: Entering directory 'C:/qt5/qt5/qtbase/src/tools'
    cd bootstrap\ && ( if not exist Makefile C:\qt5\qt5\qtbase\bin\qmake C:\qt5\qt5
    qtbase\src\tools\bootstrap\ -o Makefile ) && mingw32-make -f Makefi
    Project MESSAGE: C:\qt5\qt5\qtbase\bin\syncqt.bat -minimal -module QtCore -modul
    e QtDBus -module QtXml -mkspecsdir C:/qt5/qt5/qtbase/mkspecs -outdir C:/qt5/qt5/
    qtbase C:/qt5/qt5/qtbase
    <srcbase> = C:/qt5/qt5/qtbase
    <outbase> = C:/qt5/qt5/qtbase
    QtDBus: created fwd-include header(s) for <srcbase>/src/dbus/ { qdbus_symbols_p.
    h (1), qdbusabstractadaptor.h (1), qdbusabstractadaptor_p.h (1), qdbusabstractin
    terface.h (1), qdbusabstractinterface_p.h (1), qdbusargument.h (1), qdbusargumen
    t_p.h (1), qdbusconnection.h (1), qdbusconnection_p.h (1), qdbusconnectioninterf
    ace.h (1), qdbusconnectionmanager_p.h (1), qdbuscontext.h (1), qdbuscontext_p.h
    (1), qdbuserror.h (1), qdbusextratypes.h (1), qdbusintegrator_p.h (1), qdbusinte
    rface.h (1), qdbusinterface_p.h (1), qdbusintrospection_p.h (1), qdbusmacros.h (
    1), qdbusmessage.h (1), qdbusmessage_p.h (1), qdbusmetaobject_p.h (1), qdbusmeta
    type.h (1), qdbusmetatype_p.h (1), qdbuspendingcall.h (1), qdbuspendingcall_p.h
    (1), qdbuspendingreply.h (1), qdbusreply.h (1), qdbusserver.h (1), qdbusservicew
    atcher.h (1), qdbusthreaddebug_p.h (1), qdbusunixfiledescriptor.h (1), qdbusutil
    _p.h (1), qdbusvirtualobject.h (1), qdbusxmlparser_p.h (1) }
    QtXml: created fwd-include header(s) for <srcbase>/src/xml/ { qtxmlglobal.h (1)
    QtXml: created fwd-include header(s) for <srcbase>/src/xml/dom/ { qdom.h (1) }
    QtXml: created fwd-include header(s) for <srcbase>/src/xml/sax/ { qxml.h (1) }
    mingw32-make[4]: Entering directory 'C:/qt5/qt5/qtbase/src/tools/bootstrap'
    mingw32-make -f Makefile.Release
    mingw32-make[5]: Entering directory 'C:/qt5/qt5/qtbase/src/tools/bootstrap'
    Makefile.Release:189: *** missing separator. Stop.
    mingw32-make[5]: Leaving directory 'C:/qt5/qt5/qtbase/src/tools/bootstrap'
    Makefile:34: recipe for target 'release' failed
    mingw32-make[4]: *** [release] Error 2
    mingw32-make[4]: Leaving directory 'C:/qt5/qt5/qtbase/src/tools/bootstrap'
    Makefile:44: recipe for target 'sub-tools-bootstrap-make_first' failed
    mingw32-make[3]: *** [sub-tools-bootstrap-make_first] Error 2
    mingw32-make[3]: Leaving directory 'C:/qt5/qt5/qtbase/src/tools'
    Makefile:53: recipe for target 'sub-tools-make_first' failed
    mingw32-make[2]: *** [sub-tools-make_first] Error 2
    mingw32-make[2]: Leaving directory 'C:/qt5/qt5/qtbase/src'
    Makefile:42: recipe for target 'sub-src-make_first' failed
    mingw32-make[1]: *** [sub-src-make_first] Error 2
    mingw32-make[1]: Leaving directory 'C:/qt5/qt5/qtbase'
    makefile:54: recipe for target 'module-qtbase-make_first' failed
    mingw32-make: *** [module-qtbase-make_first] Error 2


    the wrong line where it says "wrong separator" is in bootstrap makefile:

    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo.obj\release_shared\ @<<

    Any idea what I am doing wrong?

  • As often as soon as I posted the previous message I found it. Needed to set QMAKESPEC=QTDIR\mkspecs\win32-g++ and all seems ok now.

    Sorry for the disturbance, anyway I hope it might be useful to someone...

Log in to reply