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 -1I 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.
Thanks,
Mengda -
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
-
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.
-
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 http://qt-project.org/downloads
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!
-
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 directoryg++.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.
COLLECT_GCC=C:\Qt5\Tools\mingw48_32\bin\g++.exe
COLLECT_LTO_WRAPPER=c:/qt5/tools/mingw48_32/bin/../libexec/gcc/i686-w64-mingw32/4.8.0/lto-wrapper.exe
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=http://sourceforge.net/projects/mingwbuilds/ 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) -
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!
-
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]
@
COLLECT_GCC=C:\Qt5\Tools\mingw48_32\bin\g++.exe
@
[/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
-
[quote]
@- 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
@
[/quote]
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