girish
Posted by girish
 in
 on Tuesday, January 30, 2007 @ 08:07

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.

8 Responses to “Qt/MSYS”

» Posted by jstaniek
 on Tuesday, January 30, 2007 @ 08:44

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?

» Posted by anonymous
 on Wednesday, January 31, 2007 @ 00:18

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.

» Posted by Will Stokes
 on Wednesday, January 31, 2007 @ 13:46

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.

» Reply from girish
 on Wednesday, January 31, 2007 @ 15:32

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.

» Reply from girish
 on Wednesday, January 31, 2007 @ 15:35

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.

» Posted by bobbybrasko
 on Saturday, February 03, 2007 @ 12:31

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
.3.0-snapshot-20070202/bin/syncqt.bat)
Creating qmake…
g++ -c -omakefile.o -O -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -IC:\msys\
1.0\home\bobbybrasko\download\qt-4.3\qt-win-opensource-src-4.3.0-snapshot-20070202/src/corelib/arch/gene
ric -IC:\msys\1.0\home\bobbybrasko\download\qt-4.3\qt-win-opensource-src-4.3.0-snapshot-20070202/include
-IC:\msys\1.0\home\bobbybrasko\download\qt-4.3\qt-win-opensource-src-4.3.0-snapshot-20070202/include/Qt
Core -IC:\msys\1.0\home\bobbybrasko\download\qt-4.3\qt-win-opensource-src-4.3.0-snapshot-20070202/includ
e -IC:\msys\1.0\home\bobbybrasko\download\qt-4.3\qt-win-opensource-src-4.3.0-snapshot-20070202/include/Q
tCore -IC:\msys\1.0\home\bobbybrasko\download\qt-4.3\qt-win-opensource-src-4.3.0-snapshot-20070202/src/c
orelib/global -IC:\msys\1.0\home\bobbybrasko\download\qt-4.3\qt-win-opensource-src-4.3.0-snapshot-200702
02/src/3rdparty/md5 -IC:\msys\1.0\home\bobbybrasko\download\qt-4.3\qt-win-opensource-src-4.3.0-snapshot-
20070202/mkspecs/win32-g++ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_N
O_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT
_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQMAKE_OPENSOURCE_EDITION generators/makefile.cpp
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

» Posted by bobbybrasko
 on Saturday, February 03, 2007 @ 12:44

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?

» Reply from girish
 on Saturday, February 03, 2007 @ 15:52

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

» Posted by mediaid
 on Thursday, February 15, 2007 @ 11:54

Hey friends, Thank you !



© 2008 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners.