cross compile Qt5 source on DM8168/AM389x
-
This is your problem
cc1plus: error: unrecognized command line option "-std=gnu++11"
. The-std=gnu++11
is not valid in your compiler. Which makes sense. Most ARM compilers are not very up to date. If you need c++11 support try changing gnu++11 to c++11 and that should fix your issue.This assumes that your compiler supports c++11, which it may not at all, in which case you have to remove c++11 support.
Edit: Oops I should read more.. this is compiling Qt source not your own project. You will need to disable c++11 support in Qt if your ARM compiler doesn't support it. I'm not sure if that's even possible now-a-days, but a quick
./configure --help
should give you the answer. -
@ambershark @Alex_wang Qt itself requires C++11 since (I think) 5.6, so without C++11 5.9.1 will for sure not build.
-
@Alex_wang Does "configure --help" show anything?
-
@Alex_wang Here's from
./configure --help
:-c++std <edition> .... Select C++ standard <edition> [c++1z/c++14/c++11]
-
@ambershark @jsulm
Hi,
c++std error has been solved ,but another error is occurring:/home/wangbi/workdir_project/workdir_Qt/ToolChain/arago/bin/arm-arago-linux-gnueabi-g++ -c -pipe -mfloat-abi=softfp --sysroot=/home/wangbi/workdir_project/workdir_Qt/rfs -g -Wall -W -fPIC -I. -I/home/wangbi/workdir_project/workdir_Qt/rfs/include -I/home/wangbi/workdir_project/workdir_Qt/rfs/usr/include -I/home/wangbi/workdir_project/workdir_Qt/Qt5.8/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/devices/linux-arm-gnueabi-ti-g++ -o arch.o arch.cpp > In file included from ../../src/corelib/global/archdetect.cpp:41:0, > from arch.cpp:42: > ../../src/corelib/global/qprocessordetection.h:145:6: error: #error "ARM architecture too old" > Makefile:221: recipe for target 'arch.o' failed > make: *** [arch.o] Error 1 Project ERROR: Could not determine target architecture. See config.log for details.
-
@Alex_wang What is your target architecture and its CPU?
-
@ambershark
configure:#!/bin/sh ./configure \ -v \ -opensource \ -confirm-license \ -device-option CROSS_COMPILE=/home/wangbi/workdir_project/workdir_Qt/ToolChain/arago-2011.09/armv7a/bin/arm-arago-linux-gnueabi- \ -device linux-arm-gnueabi-ti-g++ \ -prefix /usr/local/qt5 \ -extprefix /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt5 \ -hostprefix /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt5-host \ -nomake examples \ -nomake tests \ -opengl es2 \ -c++std c++11 \ -sysroot /home/wangbi/workdir_project/workdir_Qt/rfs
but the error still :
> cc1plus: error: unrecognized command line option "-std=gnu++11" > Makefile:188: recipe for target 'opengles2.o' failed > make: *** [opengles2.o] Error 1 => source failed verification. test config.gui.libraries.opengl_es2 FAILED
the c++11 check:
Checking for compiler defaulting to C++11 or higher... + cd /home/wangbi/workdir_project/workdir_Qt/Qt5.8/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/common/c++98default && /home/wangbi/workdir_project/workdir_Qt/Qt5.8/qt-everywhere-opensource-src-5.8.0/qtbase/bin/qmake -qtconf /home/wangbi/workdir_project/workdir_Qt/Qt5.8/qt-everywhere-opensource-src-5.8.0/qtbase/bin/qt.conf "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console" "QMAKE_CFLAGS += --sysroot=/home/wangbi/workdir_project/workdir_Qt/rfs" "QMAKE_CXXFLAGS += --sysroot=/home/wangbi/workdir_project/workdir_Qt/rfs" "QMAKE_LFLAGS += --sysroot=/home/wangbi/workdir_project/workdir_Qt/rfs" /home/wangbi/workdir_project/workdir_Qt/Qt5.8/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/common/c++98default + cd /home/wangbi/workdir_project/workdir_Qt/Qt5.8/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/common/c++98default && MAKEFLAGS= /usr/bin/make > /home/wangbi/workdir_project/workdir_Qt/ToolChain/arago-2011.09/armv7a/bin/arm-arago-linux-gnueabi-g++ -c -pipe -march=armv7-a -mfloat-abi=softfp --sysroot=/home/wangbi/workdir_project/workdir_Qt/rfs -O2 -Wall -W -fPIC -I. -I/home/wangbi/workdir_project/workdir_Qt/rfs/include -I/home/wangbi/workdir_project/workdir_Qt/rfs/usr/include -I/home/wangbi/workdir_project/workdir_Qt/rfs/usr/include/EGL -I/home/wangbi/workdir_project/workdir_Qt/rfs/usr/include/EWS -I/home/wangbi/workdir_project/workdir_Qt/rfs/usr/include/GLES -I/home/wangbi/workdir_project/workdir_Qt/rfs/usr/include/GLES2 -I/home/wangbi/workdir_project/workdir_Qt/rfs/usr/include/KHR -I/home/wangbi/workdir_project/workdir_Qt/Qt5.8/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/devices/linux-arm-gnueabi-ti-g++ -o c++98default.o c++98default.cpp > c++98default.cpp:41:2: error: #error "compiler does not use c++11 or higher by default" > Makefile:176: recipe for target 'c++98default.o' failed > make: *** [c++98default.o] Error 1 test config.qtbase.tests.cxx11default FAILED
-
@Alex_wang Looks like your compiler doesn't support c++11 or higher. You will need a more modern compiler to use Qt newer than 5.6.
-
@jsulm said in cross compile Qt5 source on DM8168/AM389x:
@ambershark @Alex_wang Qt itself requires C++11 since (I think) 5.6, so without C++11 5.9.1 will for sure not build.
Actually, Qt 5.6 was the last Qt version that didn't need a C++11 compiler [1][2]. Version 5.7 was the first one with that requirement.
[1] Except if you want to use QtSerialBus, which is a Technology Preview in Qt 5.6 and already required C++11.
[2] And it is the last version supporting Windows XP. -
@Alex_wang said in cross compile Qt5 source on DM8168/AM389x:
arago-2011.09/armv7a/bin/arm-arago-linux-gnueabi
Looks quite old. Can you get a newer one?
-
Thanks for your reply!
using the gcc-linaro-6.3.1-2017.05-i686_arm-linux-gnueabi tool chain , then solve the error!
but new error occur:
home/wangbi/workdir_project/workdir_Qt/rfs/lib -lgthread-2.0 -lrt -lglib-2.0 .obj/qlogging.o:qlogging.cpp:function QMessagePattern::setPattern(QString const&): error: undefined reference to '__cxa_throw_bad_array_new_length' .obj/qlogging.o:qlogging.cpp:function QMessagePattern::setPattern(QString const&): error: undefined reference to '__cxa_throw_bad_array_new_length' .obj/qhash.o:qhash.cpp:function QHashData::detach_helper(void (*)(QHashData::Node*, void*), void (*)(QHashData::Node*), int, int): error: undefined reference to '__cxa_throw_bad_array_new_length' .obj/qhash.o:qhash.cpp:function QHashData::rehash(int): error: undefined reference to '__cxa_throw_bad_array_new_length' collect2: error: ld returned 1 exit status Makefile:1247: recipe for target '../../lib/libQt5Core.so.5.8.0' failed
-
@Alex_wang Did you start from a clean state?
-
@Alex_wang Does your new compiler support exceptions and have exception handling enabled?