qt 5.7.0 在配置后在 cygwin 中出错

qt 5.7.0 make error in cygwin after configure

[UPDATE2] qt 5.7 在 windows 环境 (cygwin/mingw) 下交叉编译似乎有问题。 qt 5.5交叉编译比较容易

我正在使用我在 cygwin 上用 crosstool-ng 生成的工具链将 qt 5.7.0 交叉编译到 raspberry pi 上的 armv7 linux 目标。

主机:cygwin 工具链:armv7-rpi2-linux-gnueabihf(通过 crosstool-ng 生成) 目标:armv7 linux

我下载并提取了 qt 5.7.0 tarball,并从 cygwin shell 中将其提取到 cygwin 目录结构下(即我没有使用 winzip/7zip 提取文件)。

配置命令:

~/qtpi]$ ./configure -prefix /cygdrive/c/qt5pi -debug-and-release -no-accessibility -device
linux-rpi3-g++ -opensource -confirm-license -make libs -platform cygwin-g++ 
-device-option CROSS_COMPILE=/cygdrive/c/cygwin64/home/admin/x-tools/armv7-rpi2-linux-gnueabihf/bin/armv7-rpi2-linux-gnueabihf-
-sysroot /cygdrive/c/cygwin64/home/admin/x-tools/armv7-rpi2-linux-gnueabihf/armv7-rpi2-linux-gnueabihf/sysroot -v

配置完成如下...

   ...
   ...
   xkbcommon-x11........... no
   xkbcommon-evdev......... no
   zlib ................... yes (bundled copy)


NOTE: Qt is using double for qreal on this system. This is binary
incompatible against Qt 5.1. Configure with '-qreal float' to create a build 
that is binary compatible with 5.1.

Qt is now configured for building. Just run 'make'. Once everything is 
built, you must run 'make install'. Qt will be installed into 
/cygdrive/c/qt5pi

Prior to reconfiguration, make sure you remove any leftovers from the 
previous build.

此时运行 make报错如下:

~/qtpi]$ make
cd qtbase/ && ( test -e Makefile || /home/admin/qtpi/qtbase/bin/qmake /home/admin/qtpi/qtbase/qtbase.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && /usr/bin/make -f Makefile
make[1]: Entering directory '/home/admin/qtpi/qtbase'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make[1]: *** [Makefile:43: sub-src-make_first] Error 1
make[1]: Leaving directory '/home/admin/qtpi/qtbase'
make: *** [Makefile:78: module-qtbase-make_first] Error 2

卡在这里半天了。据我所知,这似乎与 dos-unix 行结尾或 mingw shell(我也通过 mingw 得到同样的错误)

[UPDATE1] 这里是 /home/admin/qtpi/qtbase/Makefile 的前 200 多行供参考。

#############################################################################
# Makefile for building: qtbase
# Generated by qmake (3.0) (Qt 5.7.0)
# Project:  qtbase.pro
# Template: subdirs
# Command: /home/admin/qtpi/qtbase/bin/qmake -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile qtbase.pro
#############################################################################

MAKEFILE      = Makefile

first: make_first
QMAKE         = /home/admin/qtpi/qtbase/bin/qmake
DEL_FILE      = del
CHK_DIR_EXISTS= if not exist
MKDIR         = mkdir
COPY          = copy /y
COPY_FILE     = copy /y
COPY_DIR      = xcopy /s /q /y /i
INSTALL_FILE  = copy /y
INSTALL_PROGRAM = copy /y
INSTALL_DIR   = xcopy /s /q /y /i
DEL_FILE      = del
SYMLINK       = ln -f -s
DEL_DIR       = rmdir
MOVE          = move
SUBTARGETS    =  \
        sub-src \
        sub-examples \
        sub-tests \
        sub-qmake-qmake-aux-pro


sub-src-qmake_all:  FORCE
    @if not exist src/ mkdir src/ & if not exist src/ exit 1
    cd src/ && $(QMAKE) /home/admin/qtpi/qtbase/src/src.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd src/ && $(MAKE) -f Makefile qmake_all
sub-src: FORCE
    @if not exist src/ mkdir src/ & if not exist src/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd src/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/src/src.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile
sub-src-make_first: FORCE
    @if not exist src/ mkdir src/ & if not exist src/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd src/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/src/src.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile 
sub-src-all: FORCE
    @if not exist src/ mkdir src/ & if not exist src/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd src/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/src/src.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile all
sub-src-clean: FORCE
    @if not exist src/ mkdir src/ & if not exist src/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd src/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/src/src.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile clean
sub-src-distclean: FORCE
    @if not exist src/ mkdir src/ & if not exist src/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd src/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/src/src.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile distclean
sub-src-install_subtargets: FORCE
    @if not exist src/ mkdir src/ & if not exist src/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd src/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/src/src.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile install
sub-src-uninstall_subtargets: FORCE
    @if not exist src/ mkdir src/ & if not exist src/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd src/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/src/src.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile uninstall
sub-examples-qmake_all: sub-src-qmake_all FORCE
    @if not exist examples/ mkdir examples/ & if not exist examples/ exit 1
    cd examples/ && $(QMAKE) /home/admin/qtpi/qtbase/examples/examples.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd examples/ && $(MAKE) -f Makefile qmake_all
sub-examples: sub-src FORCE
    @if not exist examples/ mkdir examples/ & if not exist examples/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd examples/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/examples/examples.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile
sub-examples-make_first: sub-src-make_first FORCE
    @if not exist examples/ mkdir examples/ & if not exist examples/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd examples/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/examples/examples.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile 
sub-examples-all: sub-src-all FORCE
    @if not exist examples/ mkdir examples/ & if not exist examples/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd examples/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/examples/examples.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile all
sub-examples-clean: sub-src-clean FORCE
    @if not exist examples/ mkdir examples/ & if not exist examples/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd examples/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/examples/examples.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile clean
sub-examples-distclean: sub-src-distclean FORCE
    @if not exist examples/ mkdir examples/ & if not exist examples/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd examples/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/examples/examples.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile distclean
sub-examples-install_subtargets: sub-src-install_subtargets FORCE
    @if not exist examples/ mkdir examples/ & if not exist examples/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd examples/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/examples/examples.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile install
sub-examples-uninstall_subtargets: sub-src-uninstall_subtargets FORCE
    @if not exist examples/ mkdir examples/ & if not exist examples/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd examples/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/examples/examples.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile uninstall
sub-tests-qmake_all: sub-src-qmake_all FORCE
    @if not exist tests/ mkdir tests/ & if not exist tests/ exit 1
    cd tests/ && $(QMAKE) /home/admin/qtpi/qtbase/tests/tests.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd tests/ && $(MAKE) -f Makefile qmake_all
sub-tests: sub-src FORCE
    @if not exist tests/ mkdir tests/ & if not exist tests/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd tests/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/tests/tests.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile
sub-tests-make_first: sub-src-make_first FORCE
    @if not exist tests/ mkdir tests/ & if not exist tests/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd tests/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/tests/tests.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile 
sub-tests-all: sub-src-all FORCE
    @if not exist tests/ mkdir tests/ & if not exist tests/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd tests/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/tests/tests.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile all
sub-tests-clean: sub-src-clean FORCE
    @if not exist tests/ mkdir tests/ & if not exist tests/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd tests/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/tests/tests.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile clean
sub-tests-distclean: sub-src-distclean FORCE
    @if not exist tests/ mkdir tests/ & if not exist tests/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd tests/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/tests/tests.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile distclean
sub-tests-install_subtargets: sub-src-install_subtargets FORCE
    @if not exist tests/ mkdir tests/ & if not exist tests/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd tests/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/tests/tests.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile install
sub-tests-uninstall_subtargets: sub-src-uninstall_subtargets FORCE
    @if not exist tests/ mkdir tests/ & if not exist tests/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd tests/ && ( if not exist Makefile $(QMAKE) /home/admin/qtpi/qtbase/tests/tests.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile ) && $(MAKE) -f Makefile uninstall
sub-qmake-qmake-aux-pro-qmake_all:  FORCE
    @if not exist qmake/ mkdir qmake/ & if not exist qmake/ exit 1
    cd qmake/ && $(QMAKE) /home/admin/qtpi/qtbase/qmake/qmake-aux.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile.qmake-aux
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd qmake/ && $(MAKE) -f Makefile.qmake-aux qmake_all
sub-qmake-qmake-aux-pro: FORCE
    @if not exist qmake/ mkdir qmake/ & if not exist qmake/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd qmake/ && ( if not exist Makefile.qmake-aux $(QMAKE) /home/admin/qtpi/qtbase/qmake/qmake-aux.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile.qmake-aux ) && $(MAKE) -f Makefile.qmake-aux
sub-qmake-qmake-aux-pro-make_first: FORCE
    @if not exist qmake/ mkdir qmake/ & if not exist qmake/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd qmake/ && ( if not exist Makefile.qmake-aux $(QMAKE) /home/admin/qtpi/qtbase/qmake/qmake-aux.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile.qmake-aux ) && $(MAKE) -f Makefile.qmake-aux 
sub-qmake-qmake-aux-pro-all: FORCE
    @if not exist qmake/ mkdir qmake/ & if not exist qmake/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd qmake/ && ( if not exist Makefile.qmake-aux $(QMAKE) /home/admin/qtpi/qtbase/qmake/qmake-aux.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile.qmake-aux ) && $(MAKE) -f Makefile.qmake-aux all
sub-qmake-qmake-aux-pro-clean: FORCE
    @if not exist qmake/ mkdir qmake/ & if not exist qmake/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd qmake/ && ( if not exist Makefile.qmake-aux $(QMAKE) /home/admin/qtpi/qtbase/qmake/qmake-aux.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile.qmake-aux ) && $(MAKE) -f Makefile.qmake-aux clean
sub-qmake-qmake-aux-pro-distclean: FORCE
    @if not exist qmake/ mkdir qmake/ & if not exist qmake/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd qmake/ && ( if not exist Makefile.qmake-aux $(QMAKE) /home/admin/qtpi/qtbase/qmake/qmake-aux.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile.qmake-aux ) && $(MAKE) -f Makefile.qmake-aux distclean
sub-qmake-qmake-aux-pro-install_subtargets: FORCE
    @if not exist qmake/ mkdir qmake/ & if not exist qmake/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd qmake/ && ( if not exist Makefile.qmake-aux $(QMAKE) /home/admin/qtpi/qtbase/qmake/qmake-aux.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile.qmake-aux ) && $(MAKE) -f Makefile.qmake-aux install
sub-qmake-qmake-aux-pro-uninstall_subtargets: FORCE
    @if not exist qmake/ mkdir qmake/ & if not exist qmake/ exit 1
    @set MAKEFLAGS=$(MAKEFLAGS)
    cd qmake/ && ( if not exist Makefile.qmake-aux $(QMAKE) /home/admin/qtpi/qtbase/qmake/qmake-aux.pro -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile.qmake-aux ) && $(MAKE) -f Makefile.qmake-aux uninstall


Makefile: qtbase.pro .qmake.conf .qmake.cache mkspecs/win32-msvc2012/qmake.conf mkspecs/features/spec_pre.prf \
        mkspecs/common/angle.conf \
        mkspecs/common/msvc-base.conf \
        mkspecs/common/msvc-desktop.conf \
        mkspecs/qconfig.pri \
        mkspecs/features/qt_functions.prf \
        mkspecs/features/qt_config.prf \
        mkspecs/features/win32/qt_config.prf \
        mkspecs/win32-msvc2012/qmake.conf \
        mkspecs/features/spec_post.prf \
        mkspecs/qmodule.pri \
        mkspecs/features/qt_build_config.prf \
        .qmake.conf \
        .qmake.stash \
        mkspecs/features/exclusive_builds.prf \
        mkspecs/features/default_pre.prf \
        mkspecs/features/win32/default_pre.prf \
        mkspecs/features/qt_parts.prf \
        mkspecs/modules/qt_tool_syncqt.pri \
        mkspecs/features/resolve_config.prf \
        mkspecs/features/exclusive_builds_post.prf \
        mkspecs/features/default_post.prf \
        mkspecs/features/exceptions_off.prf \
        mkspecs/features/qt_example_installs.prf \
        mkspecs/features/qt_docs_targets.prf \
        mkspecs/features/precompile_header.prf \
        mkspecs/features/warn_on.prf \
        mkspecs/features/file_copies.prf \
        mkspecs/features/qt_build_extra.prf \
        mkspecs/features/win32/windows.prf \
        mkspecs/features/win32/rtti_off.prf \
        mkspecs/features/testcase_targets.prf \
        mkspecs/features/yacc.prf \
        mkspecs/features/lex.prf \
        qtbase.pro
    $(QMAKE) -qtconf /home/admin/qtpi/qtbase/bin/qt.conf -o Makefile qtbase.pro
mkspecs/features/spec_pre.prf:
mkspecs/common/angle.conf:
mkspecs/common/msvc-base.conf:
mkspecs/common/msvc-desktop.conf:
mkspecs/qconfig.pri:
mkspecs/features/qt_functions.prf:
mkspecs/features/qt_config.prf:
mkspecs/features/win32/qt_config.prf:
mkspecs/win32-msvc2012/qmake.conf:
mkspecs/features/spec_post.prf:
mkspecs/qmodule.pri:
mkspecs/features/qt_build_config.prf:
.qmake.conf:
.qmake.stash:
mkspecs/features/exclusive_builds.prf:
mkspecs/features/default_pre.prf:
mkspecs/features/win32/default_pre.prf:
mkspecs/features/qt_parts.prf:
mkspecs/modules/qt_tool_syncqt.pri:
mkspecs/features/resolve_config.prf:
mkspecs/features/exclusive_builds_post.prf:
mkspecs/features/default_post.prf:
mkspecs/features/exceptions_off.prf:
mkspecs/features/qt_example_installs.prf:
mkspecs/features/qt_docs_targets.prf:
mkspecs/features/precompile_header.prf:
mkspecs/features/warn_on.prf:
mkspecs/features/file_copies.prf:
mkspecs/features/qt_build_extra.prf:
mkspecs/features/win32/windows.prf:
mkspecs/features/win32/rtti_off.prf:
mkspecs/features/testcase_targets.prf:
mkspecs/features/yacc.prf:
mkspecs/features/lex.prf:
qtbase.pro:
qmake: FORCE

请帮我解决这个问题!

https://forum.qt.io/topic/69482/cannot-compile-qmake-for-win32-g-cross-compiling

在这个来自 qt 支持论坛的 link 中,看起来 qt 5.7 在 windows 上编译它有一些问题。 我正在使用没有问题的 5.5 版本

根据@Torugobeck 指出的cannot-compile-qmake-for-win32-g-cross-compiling,我尝试交叉编译Qt5.5,它似乎已经走过场并在Cygwin下完成了'make'和'make install' -但是使用 cygwin-g++ 平台(而不是 mingw 下的 win32-g++ 平台选项)

配置在 above link 中概述的 2 个阶段中成功。

从这个配置命令开始:

./configure -prefix /cygdrive/c/qtpi5 -debug-and-release -no-accessibility  
-opensource -confirm-license -make libs -platform cygwin-g++ 
-device linux-rasp-pi2-g++ -sysroot /cygdrive/c/cygwin64/home/admin/x-tools/armv7-rpi2-linux-gnueabihf/armv7-rpi2-linux-gnueabihf/sysroot -v

这成功为 windows 生成了 qmake 二进制文件。

然后按照 above link 中所述编辑 /qtbase/configure 文件。

继续此配置命令:

 ./configure -prefix /cygdrive/c/qtpi5 -debug-and-release -no-accessibility  
-opensource -confirm-license -make libs -platform cygwin-g++ 
-device linux-rasp-pi2-g++ -sysroot /cygdrive/c/cygwin64/home/admin/x-tools/armv7-rpi2-linux-gnueabihf/armv7-rpi2-linux-gnueabihf/sysroot 
-v -device-option CROSS_COMPILE=/cygdrive/c/cygwin64/home/admin/x-tools/armv7-rpi2-linux-gnueabihf/bin/armv7-rpi2-linux-gnueabihf-

函数 /home/admin/qtpi/qtbase/src/corelib/global/qglobal.cpp:determineWinOsVersionPost8 windows 与版本检测相关的故障

我强制函数 return 为真并在输出参数上填写相关 OS 版本信息。

此配置完成后。 'make' 只用了 4 小时就完成了,没有出现错误 - 接下来 'make install' 也是如此。

我编译了一个最小的 GUI 程序 qith qt5 并且能够在目标 - raspberry 上执行它 PI/arm7-linux。

简而言之,cygwin 能够使用 .

成功地交叉编译 qt 5.5

p.s GUI 可执行文件无法启动 GUI,似乎只是挂在那里并显示以下警告...

libEGL warning: DRI2: failed to authenticate 

我正在调查此事。