使用 Qt Creator 在 Linux 下构建 Windows
我需要在使用 Fedora 14 时编译适用于 Windows 的 Qt 应用程序,Fedora 14 具有 Qt Creator MinGW 的二进制包。我正确安装了所有必需的交叉编译包,并将 qmake 的路径添加为 /usr/bin/mingw32-qmake-qt4
。 Qt Creator 无法获取足够的环境变量来设置所需的工具链。
经过一番挖掘,我发现 Qt Creator 使用参数 -query
调用指定的 qmake 路径来获取这些变量。
我发现直接调用/usr/bin/mingw32-qmake-qt4 -query
会出现错误***Unknown option -query
。所以我猜 Qt Creator 是无辜的。
然后我发现 /usr/bin/mingw32-qmake-qt4 只不过是使用 /usr/libexec/mingw32-scripts
的通用脚本的符号链接代码>基本名称$0,<代码>rpm --eval,bla bla bla。
现在我累了。以前有人能解决这个问题吗?
这些是我安装的软件包的版本(它们是截至 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
我忘了说我更喜欢使用 Fedora 存储库提供的二进制软件包而不是本地构建的库或工具
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我快速浏览了 Fedora 15 安装中发生的情况。
mingw32-qmake-qt4 是一个浅层包装器,基本上只调用 qmake -spec win32-g++-cross $0 。现在,如果您调用
mingw32-qmake-qt4 -query
,-spec
和-query
选项都会传递给 qmake。然而,Qmake 很愚蠢,无法同时接受这两个选项,并给出错误消息。我想可以通过用硬编码了 -spec 选项的正确可执行文件替换 mingw32-qmake 包装脚本来修复它。这样,就没有必要使用 -spec 选项,并且您将获得一个有效的 -query 选项。
您可能想写信给 Fedora MinGW 邮件列表,也许那里有人有更好的想法如何解决这个问题。
I took a quick look at what's happening on my Fedora 15 installation.
mingw32-qmake-qt4
is a shallow wrapper that basically just invokesqmake -spec win32-g++-cross $0
. Now, if you callmingw32-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.