如何构建Qt 5.7.0进行交叉编译?

时间:2016-11-13 05:58:09

标签: c++ linux qt5 cross-compiling

如何在Ubuntu上构建Qt 5.7.0以交叉编译到Windows?

我有这个错误:

In file included from qt-everywhere-opensource-src-5.7.0/qtbase/include/QtCore/qt_windows.h:1:0,
             from main.cpp:33:
qt-everywhere-opensource-src-5.7.0/qtbase/include/QtCore/../../src/corelib/global/qt_windows.h:61:21: fatal error: windows.h: No such file or directory

我的配置选项:

./configure -opensource -c++std c++11 -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32- -device-option PKG_CONFIG=i686-w64-mingw32-pkg-config -force-pkg-config -prefix /opt/qt/qt-5.7.0-win32 -nomake examples

windows.h有路径:/usr/i686-w64-mingw32/include/windows.h

注意:我不想使用MXE。

1 个答案:

答案 0 :(得分:0)

不确定这是否是正确的解决方案,但似乎Qt尝试在ActiveQt(仅限Windows)下构建其中一个工具作为本机。

我在这里编辑了这个文件:

<强> qtactiveqt / SRC /工具/ IDC / idc.pro

并且注释了两个第一行,这似乎解决了这个问题。

(我也确实将binfmt配置为通过wine运行.exe文件,这可能会影响它是否尝试将idc工具作为本机工具运行)