开发者

Building for Windows under Linux using Qt Creator

I need to compile my Qt application for Windows while I am using Fedora 14 which have binary packages for Qt Creator MinGW. I installed all the required cross compiling packages correctly and added the path for qmake as /usr/bin/mingw32-qmake-qt4. Qt Creator can't obtain enough environment variables to setup the required toolchain.

After little digging I discovered that Qt Creator calls the specified qmake path with the parameter -query to get these variables.

I found that calling /usr/bin/mingw32-qmake-qt4 -query directly gives the error ***Unknown option -query. So I guess Qt Creator is innocent.

Then I found that /usr/bin/mingw32-qmake-qt4 is not more than a symbolic link to the generic script /usr/libexec/mingw32-scripts that uses basename $0, rpm --eval, bla bla bla.

Now I got tired. Could any body come over this before?

These are the versions of my installed packages (they are the latest as of 2011/07/06):

mingw32-binutils.i686                2.20.1-2.fc14               @updates       
mingw32-cpp.i686                     4.5.0-1.fc14                @fedora        
mingw32-dbus.noarch                  1.4.1-0.1.20101008git.fc14  @updates       
mingw32-expat.noarch                 2.0.1-6.fc13                @fedora        
mingw32-filesystem.noarch            64-2.fc14                   @updates       
mingw32-gcc.i686                     4.5.0-1.fc14                @fedora        
mingw32-gcc-c++.i686                 4.5.0-1.fc14                @fedora        
mingw32-libjpeg.noarch               7-2.fc12                    @fedora        
mingw32-libpng.noarch                1.4.3-1.fc14                @fedora        
mingw32-libtiff.noarch               3.9.5-1.fc14                @updates       
mingw32-pthreads.noarch              2.8.0-10.fc13               @fedora        
mingw32-qt.noarch                    4.7.1-3.fc14                @updates       
mingw32-qt-qmake.i686                4.7.1-2.fc14                @updates       
mingw32-runtime.noarch               3.15.2-5.fc13               @fedora        
mingw32-sqlite.noarch                3.6.22-1.fc13               @fedora        
mingw32-w32api.noarch                3.14-1.fc14                 @fedora        
mingw32-zlib.noarch                  1.2.5-1.fc14                @fedora        
qt.i686                              1:4.7.2-8.fc14              @updates       
qt-assistant.i686                    1:4.7.2-8.fc14              @updates 开发者_开发知识库      
qt-creator.i686                      2.1.0-4.rc1.fc14            @updates       
qt-demos.i686                        1:4.7.2-8.fc14              @updates       
qt-devel.i686                        1:4.7.2-8.fc14              @updates       
qt-examples.i686                     1:4.7.2-8.fc14              @updates       
qt-mysql.i686                        1:4.7.2-8.fc14              @updates       
qt-webkit.i686                       1:4.7.2-8.fc14              @updates       
qt-x11.i686                          1:4.7.2-8.fc14              @updates 

I forgot to say that I prefer using the binary packages provided by Fedora repos over locally built libraries or tools


I took a quick look at what's happening on my Fedora 15 installation.

mingw32-qmake-qt4 is a shallow wrapper that basically just invokes qmake -spec win32-g++-cross $0. Now, if you call mingw32-qmake-qt4 -query, both the -spec and -query options get passed down to qmake. Qmake however is stupid enough to NOT accept these two options together and gives you the error message.

I suppose it might be possible to fix it by replacing the mingw32-qmake wrapper script with a proper executable that has the -spec option hardcoded. That way, it would become unnecessary to use the -spec option and you'd get a working -query option.

You might want to write to the Fedora MinGW mailing list, maybe someone over there has a better idea how to solve this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜