Important: Please read the Qt Code of Conduct -

Compile Qt 5.1.1 with Cygwin (64bit) shipped MinGW64 compiler on Windows 7

  • Hi All,

    I installed the MingGW64 compilers shipped with Cygwin64 (mingw64-x86_64-gcc-core, mingw64-x86_64-gcc-g++). I would like to use them to compile Qt 5.1.1. Note I am not using the one from official MingGW-w64 website but I used those installed from Cygwin64.

    I ran "./configure.bat -opensource -debug-and-release". It gave me some errors:

    Unable to detect the platform from environment. Use -platform command lineargume
    nt or set the QMAKESPEC environment variable and run configure again
    See the README file for a list of supported operating systems and compilers.

    So I rerun with "./configure.bat -platform win32-g++ -opensource -debug-and-release". win32-g++ is the closest mkspec I could find. It gave me some errors too:

    Creating qmake...
    execute: File or path is not found (mingw32-make)
    execute: File or path is not found (mingw32-make)
    Cleaning qmake failed, return code -1

    I believe mingw32-make is not shipped with Cygwin. I only have a "make" under /bin.

    I am kind of stuck here. I think I need a better mkspec for my setup. Can anyone help? I don't think any spec under qtbase/mkspecs/ suffices.


  • Moderators

    You need to modify the mkspecs and point it to right binaries (make instead of mingw32-make). Make specs are located in <qt source code>/mkspecs

  • I'd appreciate if you can provide a mkspec that works. I spent several hours trying and had no luck.

  • Moderators

    You just need to follow all dependencies (makefiles in mkspecs do have "include" statements) and verify that all the paths and executable names are correct for your setup. I won't do this for you, sorry. If you want it easy, use one of the prebuilt solutions, or switch to Linux where everything just works.

  • Moderators

    Are you planning to use any of the UNIX functionality that Cygwin provides? If not, just get the prebuilt native MinGW package: "Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB" at

    It even comes with the MinGW toolchain

  • I ran into this before with the mkspecs. I want to compile Qt 5.1.1 so that I can get ".a" files I can debug with. I am writing Ada bindings and I have been a little successful in creating objects in Ada and passing it to the C++ world. Widgets and pushbuttons seem to be fine. Labels no. So if had Qt all "-g"d then I can traverse through the code to see if I am not converting something properly which is keeping the object from showing. I have tried to compile with windoze but no luck. I can't even get an SDK for XP64!

  • Also I had to do a dos2unix on the ascii files from the opensource file!

  • Moderators

    Mr_Ada If you download the source code as a .zip, it will have Windows line endings. If you want Unix ones, download the tarball.

    And in general, if you want to do unix stuff, compile on Linux and you will save yourself a lot of trouble :)

    To compile Qt with debug symbols, just pass -developer-build to configure.

  • I'll try the tarball on Cygwin but I'd still would like to be able to compile on Windows XP64 since I do a lot of my development on Windows. I'll go to linux (probably Ubuntu) and see if my bindings to Ada work there as well.

    In older versions of Qt they provided debug libraries. Now it is a real pain.

  • Creating qmake...
    g++ -c -o project.o -pipe -g -g -DQMAKE_OPENSOURCE_EDITION -I/cygdrive/c/qt_src/qtbase/qmake -I/cygdrive/c/qt_src/qtbase/qmake/library -I/cygdrive/c/qt_src/qtbase/qmake/generators -I/cygdrive/c/qt_src/qtbase/qmake/generators/unix -I/cygdrive/c/qt_src/qtbase/qmake/generators/win32 -I/cygdrive/c/qt_src/qtbase/qmake/generators/mac -I/cygdrive/c/qt_src/qtbase/qmake/generators/integrity -I/cygdrive/c/qt_src/qtbase/include -I/cygdrive/c/qt_src/qtbase/include/QtCore -I/cygdrive/c/qt_src/qtbase/include/QtCore/5.1.1 -I/cygdrive/c/qt_src/qtbase/include/QtCore/5.1.1/QtCore -I/cygdrive/c/qt_src/qtbase/src/corelib/global -DHAVE_QCONFIG_CPP -I/cygdrive/c/qt_src/qtbase/mkspecs/cygwin-g++ -I/cygdrive/c/qt_src/qtbase/tools/shared -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DPROEVALUATOR_DEBUG -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM /cygdrive/c/qt_src/qtbase/qmake/project.cpp
    g++.exe: error: /cygdrive/c/qt_src/qtbase/qmake/project.cpp: No such file or directory

    g++.exe: fatal error: no input files

    compilation terminated.

    Makefile:163: recipe for target 'project.o' failed
    make: *** [project.o] Error

  • That is the error I got. The files does exist where it says it does. My g++ is the Qt5 binary distributions at:
    $ g++ -v
    Using built-in specs.
    Target: i686-w64-mingw32
    Configured with: ../../../src/gcc-4.8.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/temp/x32-480-posix-dwarf-r2/mingw32 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-host-libstdcxx='-static -lstdc++' --with-libiconv --with-system-zlib --with-gmp=/temp/mingw-prereq/i686-w64-mingw32-static --with-mpfr=/temp/mingw-prereq/i686-w64-mingw32-static --with-mpc=/temp/mingw-prereq/i686-w64-mingw32-static --with-isl=/temp/mingw-prereq/i686-w64-mingw32-static --with-cloog=/temp/mingw-prereq/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='rev2, Built by MinGW-builds project' --with-bugurl= CFLAGS='-O2 -pipe -I/temp/x32-480-posix-dwarf-r2/libs/include -I/temp/mingw-prereq/x32-zlib/include -I/temp/mingw-prereq/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/temp/x32-480-posix-dwarf-r2/libs/include -I/temp/mingw-prereq/x32-zlib/include -I/temp/mingw-prereq/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/temp/x32-480-posix-dwarf-r2/libs/lib -L/temp/mingw-prereq/x32-zlib/lib -L/temp/mingw-prereq/i686-w64-mingw32-static/lib -L/temp/x32-480-posix-dwarf-r2/mingw32/opt/lib'
    Thread model: posix
    gcc version 4.8.0 (rev2, Built by MinGW-builds project)

  • My configure command is:
    ./configure -prefix /cygdrive/c/Qt5d -debug -developer-build -opensource -confirm-license -static -platform cygwin-g++ -qt-zlib -qt-libpng -qt-libjpeg -verbose

  • Moderators

    I'm not sure if you can use the Win32 (native Windows) variant of MinGW on Cygwin. You might need a copy of MinGW that was specifically built for Cygwin.

    -I do know, however, that the configure script doesn't work on Windows, even within Cygwin. You'll need to run configure.bat instead.- EDIT: Sorry, I was thinking of MSYS, not Cygwin!

  • intersting! I would not have expected a DOS script to work in CYGWIN!

  • Moderators

    Ack, sorry, I just realized I remembered wrongly. I was thinking of MSYS, not Cygwin! I've never tried compiling Qt on Cygwin before.

    But like I said in your other thread, you'll probably have better luck doing a native Windows build instead of a Cygwin build which adds a POSIX layer to your system.

    [/quote]That's a native Windows toolchain, so I doubt that works on Cygwin either.

    What errors do you get when you try to compile in CMD?

  • Ok. My toolchain was wrong, so I fixed my path. Here is an output (I changed the folder name so that I didn't have it so long):
    C:\qt_src>configure -prefix C:\Qt5d -debug -developer-build -opensource -confirm -license -static -platform cygwin-g++ -qt-zlib -qt-libpng -qt-libjpeg -verbose

    • cd qtbase
    • C:\qt_src\qtbase\configure.bat -prefix C:\Qt5d -debug -developer-build -opensource -confirm-license -static -platform cygwin-g++ -qt-zlib -qt-libpng -qt-libjpeg -verbose
      'C:\qt_src\qtbase\configure.exe' is not recognized as an internal or external command, operable program or batch file

  • strange that it would look for an exe when there is a bat file there.

    I think I am using the tarball source code. Maybe that is throwing things off....

  • Moderators


    • cd qtbase
    • C:\qt_src\qtbase\configure.bat -prefix C:\Qt5d -debug -developer-build -opensource -confirm-license -static -platform cygwin-g++ -qt-zlib -qt-libpng -qt-libjpeg -verbose
      Don't go into 'qtbase'. Call configure.bat in C:\qt_src, and then call make in C:\qt_src.

  • first I had to resintall the Zip file instead of the tarball and I got a little further. It didn't like my -verbose so I took that out.

    Then I ran it again and I got:
    make.exe - Unable to Locate Component
    This application has failed to start because msys-1.0.dll was not found. Re-installing the application may fix this problem.

    What does msys have to do with all of this?

    Also I am not going down to qtbase. I am calling this from the qt_src level.

  • so I cleaned up my PATH so only the one mingw toolchain was visible (Qt's).

    Ran again and got this:

    C:\qt_src>configure -prefix C:\Qt5d -debug -developer-build -opensource -confirm-license -static -platform cygwin-g++ -qt-zlib -qt-libpng -qt-libjpeg

    • cd qtbase
    • C:\qt_src\qtbase\configure.bat -prefix C:\Qt5d -debug -developer-build -opensource -confirm-license -static -platform cygwin-g++ -qt-zlib -qt-libpng -qt-libjpeg

    This is the Qt for Windows Open Source Edition.

    You have already accepted the terms of the license.

    Creating qmake...
    Cleaning qmake failed, return code -1

  • duh! I still have cygwin in there!!!!

    changed to win32-g++

    seems to be compiling...

  • got this:
    Running configuration tests...
    WARNING: The DirectX SDK could not be detected:
    There is no Direct X SDK installed or the environment variable "DXSDK_DIR" is not set.
    Disabling the ANGLE backend.

    WARNING: Using OpenGL ES 2.0 without ANGLE.
    Specify -opengl desktop to use Open GL.
    The build will most likely fail.

    config info...

    then it said to:
    Qt is now configured for building. Just run mingw32-make.

    This doesn't exist in the tool chain. neither does make.

  • Moderators

    You have two choices:

    • Install the DirectX SDK, or
    • Add "-opengl desktop" to your configuration flags (your graphics card drivers needs to support OpenGL 2.0 or newer).

    In either case, make sure you clean your source tree first and the re-configure.

    If you're using the copy of MinGW that came with Qt 5.1, then mingw32-make should be in the 'bin' folder together with g++

  • I added -opengl desktop and just did a make. Don't why it is compiling now but it is. I tried to re-configure but that didn't work but it is compiling which is a good sign!

  • Ok. it stopped compiling. Here is what it is complaining about:
    mingw32-make[4]: Entering directory 'C:/qt_src/qtbase/src/widgets'
    (set PATH=C:\qt_src\qtbase\lib;%PATH:)=^)%) & C:\qt_src\qtbase\bin\uic.exe dialogs\qfiledialog.ui -o ui_qfiledialog.h
    Makefile.Debug:647: recipe for target 'ui_qfiledialog.h' failed
    mingw32-make[4]: *** [ui_qfiledialog.h] Error 255
    mingw32-make[4]: Leaving directory 'C:/qt_src/qtbase/src/widgets'
    Makefile:34: recipe for target 'debug' failed
    mingw32-make[3]: *** [debug] Error 2
    mingw32-make[3]: Leaving directory 'C:/qt_src/qtbase/src/widgets'
    Makefile:411: recipe for target 'sub-widgets-make_first' failed
    mingw32-make[2]: *** [sub-widgets-make_first] Error 2
    mingw32-make[2]: Leaving directory 'C:/qt_src/qtbase/src'
    Makefile:41: recipe for target 'sub-src-make_first' failed
    mingw32-make[1]: *** [sub-src-make_first] Error 2
    mingw32-make[1]: Leaving directory 'C:/qt_src/qtbase'
    makefile:56: recipe for target 'module-qtbase-make_first' failed
    mingw32-make: *** [module-qtbase-make_first] Error 2

  • path issue!!! Doesn't like " " in the path!

  • still compiling and linking...

  • Moderators

    Yes, it takes several hours on old PCs (it took over 3 hours to compile Qt 4.8 on my old Windows XP laptop; can't remember its specs)

    If you have a dual-core processor, passing "-j 2" or "-j 3" into mingw32-make will let it to compile with 2 or 3 threads in parallel, speeding things up a little.

    You can also only compile a subset of modules. Example:
    mingw32-make -j 3 module-qtbase
    ...this will only compile the modules in the qtbase subfolder ( shows you which modules are in which subfolder)

  • i have a quad core processor. I guess I can stop it and resubmit with -j 10 (wee hoo! it is flying now! ) LOL

  • Moderators

    Enjoy! :D

  • Gosh I must have too old a system. It went for 8 hours and still didn't finish! I had to reboot and try again with less -j #. My computer was very unresponsive.

  • ok. after several attempts to compile the windows software I am still having issues where it craps out and stop executing the make process. Here are the last mingw32-make commands before it exitted:
    mingw32-make[6]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets/validators'
    mingw32-make[5]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets/validators'
    mingw32-make[6]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets/wiggly'
    mingw32-make[5]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets/wiggly'
    mingw32-make[6]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets/windowflags'
    mingw32-make[5]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets/windowflags'
    mingw32-make[6]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets/styles'
    mingw32-make[5]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets/styles'
    mingw32-make[4]: Leaving directory 'C:/qt_src/qtbase/examples/widgets/widgets'
    mingw32-make[3]: Leaving directory 'C:/qt_src/qtbase/examples/widgets'
    mingw32-make[2]: Leaving directory 'C:/qt_src/qtbase/examples'
    mingw32-make[1]: Leaving directory 'C:/qt_src/qtbase'
    makefile:56: recipe for target 'module-qtbase-make_first' failed
    mingw32-make: *** [module-qtbase-make_first] Error 2

    my config is this:
    configure -prefix C:\Qt5d -developer-build -opensource -confirm-license -static -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop 1>R.log 2>&

  • Ok. I have given up trying to build Qt on Windows XP 64 from source. No configuration selection will make this ever complete to the end of the make process.

    What I wanted to do in order to support my bindings effort is a way to get to the source code while executing. Since GDB was barking about finding files I thought I needed to rebuild QT from src. No. I just needed to learn how to in GDB to go find the source files. Well that worked as I can step into the Qt's src but I still cannot figure out why I am not getting my sample program to display labels when I do all the constructing of that label from my Ada code. The CPP code can do it just fine so I am confused as to why. I can build a central widget, I can display a push button from Ada but not text labels. Crazy. I thought maybe it was a QFlags issue but am not sure why. Maybe there is a way to say to Qt , "hey, draw that widget now" function. This is frustrating to the nth degree, especially when only some things work.

  • Moderators

    I've never heard of 8+ hour builds before... it might have gotten stuck in a loop, or having too many threads might have caused its efficiency to plummet. I usually spawn N+1 threads, where N = # of cores.

    I'm sorry I'm unable to provide more help. May I suggest subscribing to and asking at the "Interest mailing list":, where folks are more familiar with the low-level internals of Qt and might have experience with cross-language bindings. Or ask in an Ada forum.

  • Well I got lucky tonight and figured out what was going on. My sample Ada program can generate the same objects as a CPP program can. No issues with virtual object either.

    Next biggie is to determine how to get signals/slots to work.

    Thanks for all of your help.


  • Moderators

    Glad to hear that things are looking better.

    All the best with your binding efforts!

Log in to reply