qt 5.7.0配置后在cygwin中出错

时间:2016-08-07 09:56:13

标签: linux qt makefile cygwin cross-compiling

[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来提取文件)。

configure命令:

~/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

我被困在这里半天。 AFAIK这似乎与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

请帮助我解决这个问题!

2 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:0)

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

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

从这个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

这成功地为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版本检测相关的故障

我强制该函数返回true并在out param上填写相关的OS版本信息。

此配置完成后。 'make'只花了4个小时就没有错误地完成 - 接下来就像'make install'一样。

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

简而言之, cygwin能够使用linux-armv7 cross compiler generated using crosstool-ng - also under cygwin- see UPDATE3成功交叉编译qt 5.5

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

libEGL warning: DRI2: failed to authenticate 

我正在调查此事。