sith sith - 3 months ago 29
Linux Question

qt 5.7.0 make error in cygwin after configure

[UPDATE2] qt 5.7 seems to have issues cross compiling under the windows environment (cygwin/mingw). qt 5.5 can be cross compiled relatively easily.

I am cross compiling qt 5.7.0 to armv7 linux target on raspberry pi using a toolchain I generated with crosstool-ng on cygwin.

Host: cygwin
Toolchain: armv7-rpi2-linux-gnueabihf (generated via crosstool-ng)
Target : armv7 linux

I downloaded and extracted qt 5.7.0 tarball and extracted it under the cygwin directory structure from within the cygwin shell (i.e I didnt use winzip/7zip to extract the files).

configure command:

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


configure completes as follows...

...
...
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.


At this point running make give the following error:

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


I am stuck here for half a day. AFAIK this does not seem to be related to dos-unix line endings or mingw shell ( I get the same error via mingw too)

[UPDATE1] here is the first 200+ lines of /home/admin/qtpi/qtbase/Makefile for reference.

#############################################################################
# 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


Please help me get past this!

Answer

Based on cannot-compile-qmake-for-win32-g-cross-compiling pointed out by @Torugobeck, I tried cross compiling Qt5.5 and it seems to have gone through the motions and completed 'make' and 'make install' under Cygwin - but with a cygwin-g++ platform ( instead of win32-g++ platform option under mingw )

Configure succeeded in 2 stages as outlined in the above link.

Start with this configure command :

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

This succeeded in generating the qmake binary for windows.

Then edit the /qtbase/configure file as outlined in the above link.

Continue with this configure command :

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

There was a windows version detection related failure in function /home/admin/qtpi/qtbase/src/corelib/global/qglobal.cpp:determineWinOsVersionPost8

I forced the function to return true and fillout relevant OS version information on the out param.

After this configure completed. 'make' took just 4 hrs and completed without errors - as did 'make install' next.

I compiled a minimal GUI program qith qt5 and was able to execute it on the target - raspberry PI/arm7-linux.

In short, cygwin was able to cross compile qt 5.5 successfully using a linux-armv7 cross compiler generated using crosstool-ng - also under cygwin- see UPDATE3.

p.s the GUI executable fails to launch the GUI and seems to just hang there with the following warning...

libEGL warning: DRI2: failed to authenticate 

I am investigating this.