Published Tuesday January 30th, 2007
9 Comments on Qt/MSYS
Posted in Uncategorized

Whew, finally!

Users of Qt/MinGW have been restricted to compiling and using Qt with the Windows shell cmd.exe. Compilation of Qt would fail even with the presence of the MSYS shell sh.exe in the PATH. This caveat, has over the years, resulted in very many user complaints including this, this, this, this, this and not to mention lots of support requests.

The problem is that the MinGW make mingw32-make starts spawning processes through sh.exe instead of cmd.exe when a sh.exe is found in the PATH. sh.exe, of course, does not understand Windows shell built-in commands and expects the unix path separator / causing compilation to fail.

For 4.3, we have enhanced qmake to detect sh.exe in the PATH and write out a makefile that mingw32-make/sh.exe likes. This means that you can now compile Qt and your programs using the shell of your choice. Other advantages include usage of built-in sh commands and autoconf scripts. It also turns out compilation using sh is way faster than using cmd.exe.

On a more technical note, the new QMAKE_SH variable provides the path to sh.exe (even if you are using MSVC) and MINGW_IN_SHELL is set to “1” if you are using MinGW inside a shell. If you switch shells, all you need to do is to rerun qmake.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Uncategorized


jstaniek says:

This is what I’ve been waiting for. Do you think cmake (in KDE) could work with bash.exe thanks to the improvement?

How about msvc compilers?

anonymous says:

I’d like to compile my project with Visual Studio, which doesn’t work. The Project is GPL, and I find the restriction (msys etc.) quite unnecessary.

Will Stokes says:

why do things get faster using sh.exe over cmd.exe? I mean, that’s great but I’m curios. I’d really love to be able to use the -j flag to make use of both my processors much like I do on OSX but I believe that may be a limitation in make and has nothing to do with this cmd/sh madness.

girish says:

Will: I believe compilation time is better since startup time for sh is faster. Since the sh.exe process is created and destroyed zillion times when compiling a big project like Qt, the small startup speed adds up.

girish says:

jstaniek: I am not aware of the issues faced by KDE. Feel free to send me mail if any enhancements are required for kde to work with bash.exe.

bobbybrasko says:

I tried downloading ftp://ftp.trolltech.com/qt/snapshots/qt-win-opensource-src-4.3.0-snapshot-20070202.zip
and compiling it in msys with mingw. It failed with the below message, which appears to be like the old failure message. Any idea what I need to do to get this to work? I simply did ./configure and answered yes to the license question.

Running syncqt…
execute: File or path is not found (C:/msys/1.0/home/bobbybrasko/download/qt-4.3/qt-win-opensource-src-4
Creating qmake…
g++ -c -omakefile.o -O -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -IC:msys
ric -IC:msys1.0homebobbybraskodownloadqt-4.3qt-win-opensource-src-4.3.0-snapshot-20070202/include
Core -IC:msys1.0homebobbybraskodownloadqt-4.3qt-win-opensource-src-4.3.0-snapshot-20070202/includ
e -IC:msys1.0homebobbybraskodownloadqt-4.3qt-win-opensource-src-4.3.0-snapshot-20070202/include/Q
tCore -IC:msys1.0homebobbybraskodownloadqt-4.3qt-win-opensource-src-4.3.0-snapshot-20070202/src/c
orelib/global -IC:msys1.0homebobbybraskodownloadqt-4.3qt-win-opensource-src-4.3.0-snapshot-200702
02/src/3rdparty/md5 -IC:msys1.0homebobbybraskodownloadqt-4.3qt-win-opensource-src-4.3.0-snapshot-
cc makefile.o -o Makefile
process_begin: CreateProcess((null), cc makefile.o -o Makefile, …) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [Makefile] Error 2
cc makefile.o -o Makefile
process_begin: CreateProcess((null), cc makefile.o -o Makefile, …) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [Makefile] Error 2
Cleaning qmake failed, return code 2

bobbybrasko says:

BTW, if I run ./configure again, it starts to work. I’ve repeated this 2 times now. The first ./configure fails with the above error, the next time you type ./configure it just works. Any ideas?

girish says:

bobbybrasko: Known issue and the workaround is to just run configure again. (btw, you will see this problem even without msys).

mediaid says:

Hey friends, Thank you !

Commenting closed.

Get started today with Qt Download now