cross compile Qt5 source on DM8168/AM389x



  • toolchain: arm-arago-linux-gnueabi (gcc version 4.5.3 20110311 (prerelease) (GCC) )
    root file system :
    nfs_DM816x_TI_EVM.tar.lzma ---Linux EZ Software Development Kit (EZSDK) for DM814x and DM816x - ALPHA(2012)
    qt --configs :

    include(../common/linux_device_pre.conf)
    
    ROOTFS_PATH         = /opt/DVRRDK_04.00.00.03/target/rfs
    TOOLCHAIN_PREFIX    = /opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/bin/arm-arago-linux-gnueabi
    SGX_SDK_ROOT        = /home/wangbi/workdir_project/workdir_Qt/SGX530/Graphics_SDK_5_01_01_02/Graphics_SDK_5_01_01_02
    ARM_ARAGO_LINUX_PATH= $${ROOTFS_PATH}/../../ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi
    
    
    # Change the required paths here
    QMAKE_INCDIR          += \
                            $${ROOTFS_PATH}/usr/include \
                            $${ROOTFS_PATH}/usr/include/libxml2/ \
                            $${ROOTFS_PATH}/usr/include/freetype2 
                            
    QMAKE_LIBDIR          += $${ROOTFS_PATH}/usr/lib
    
    QMAKE_INCDIR_OPENGL_ES2 = $${SGX_SDK_ROOT}/include/OGLES2
    QMAKE_LIBDIR_OPENGL_ES2 = $${SGX_SDK_ROOT}/gfx_rel_es6.x
    QMAKE_INCDIR_EGL        = $${QMAKE_INCDIR_OPENGL_ES2}
    QMAKE_LIBDIR_EGL        = $${QMAKE_LIBDIR_OPENGL_ES2}
    QMAKE_LIBDIR           += $${QMAKE_LIBDIR_OPENGL_ES2}
    
    # libs
    QMAKE_LIBS            = -lxml2 -lz -lts -lasound -lfreetype -lexpat -lfontconfig -lpng -lpthread \
                            -Wl,-rpath-link=$${ARM_ARAGO_LINUX_PATH}/lib \
                            -Wl,-rpath-link=$${ROOTFS_PATH}/usr/lib
    
    QMAKE_LIBS_OPENGL_ES2   = -lEGL -lIMGegl -lGLESv2 -lGLES_CM
    QMAKE_LIBS_EGL          = $${QMAKE_LIBS_OPENGL_ES2}
    QMAKE_LIBS_THREAD       = -lpthread
    
    
    # dbus-1.0
    QMAKE_INCDIR            +=  /usr/include/dbus-1.0
    QMAKE_INCDIR            += $${ARM_ARAGO_LINUX_PATH}/usr/lib/dbus-1.0/include
    # glib-2.0
    QMAKE_INCDIR            += $${ARM_ARAGO_LINUX_PATH}/usr/include/glib-2.0
    QMAKE_INCDIR            += $${ARM_ARAGO_LINUX_PATH}/usr/lib/glib-2.0/include
    # gstreamer-0.10
    QMAKE_INCDIR            += $${ARM_ARAGO_LINUX_PATH}/usr/include/gstreamer-0.10
    # libxml2
    QMAKE_INCDIR            += $${ARM_ARAGO_LINUX_PATH}/usr/include/libxml2
    # freetype2
    QMAKE_INCDIR            += $${ARM_ARAGO_LINUX_PATH}/usr/include/freetype2
    QMAKE_LIBDIR            += $${ARM_ARAGO_LINUX_PATH}/usr/lib
    #QMAKE_LFLAGS           += "-Wl,-rpath-link=$${ARM_ARAGO_LINUX_PATH}/usr/lib -dbus-1 -lglib-2.0 -lgthread-2.0 -lpulse -lpulse-mainloop-glib"
    
    
    
    QMAKE_CFLAGS_RELEASE   = -O3 -march=armv7-a -mfpu=neon -mfloat-abi=softfp 
    
    QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
    
    
    # When configured with -opengl es2, eglfs will be functional with its
    # dummy fullscreen X11 or kms backend, in addition to xcb.
    EGLFS_DEVICE_INTEGRATION = eglfs_kms
     
    include(../common/linux_arm_device_post.conf)
    
    load(qt_config)
    

    an error :

    Info: creating stash file /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/.qmake.stash
    
    This is the Qt Open Source Edition.
    
    You have already accepted the terms of the Open Source license.
    
    Running configuration tests...
    Checking for gold linker... 
    + cd /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/config.tests && /opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/bin/arm-arago-linux-gnueabi-g++ -fuse-ld=gold -o conftest-out conftest.cpp
    > cc1plus: error: unrecognized command line option "-fuse-ld=gold"
    test config.qtbase.tests.use_gold_linker FAILED
    Checking for machine tuple... 
    + /opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/bin/arm-arago-linux-gnueabi-g++ -dumpmachine
    > arm-arago-linux-gnueabi
    test config.qtbase.tests.machineTuple succeeded
    Checking for valid makespec... 
    + cd /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/config.tests/common/verifyspec && /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console single_arch" "QMAKE_CFLAGS += --sysroot=/opt/DVRRDK_04.00.00.03/target/rfs" "QMAKE_CXXFLAGS += --sysroot=/opt/DVRRDK_04.00.00.03/target/rfs" "QMAKE_LFLAGS += --sysroot=/opt/DVRRDK_04.00.00.03/target/rfs" -early "CONFIG += cross_compile" /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/qtbase/config.tests/common/verifyspec
    + cd /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/config.tests/common/verifyspec && MAKEFLAGS= /usr/bin/make
    > /opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/bin/arm-arago-linux-gnueabi-g++ -c -pipe -mfloat-abi=softfp --sysroot=/opt/DVRRDK_04.00.00.03/target/rfs -O3 -march=armv7-a -mfpu=neon -mfloat-abi=softfp -std=gnu++11 -Wall -W -fPIC  -I/home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/qtbase/config.tests/common/verifyspec -I. -I/opt/DVRRDK_04.00.00.03/target/rfs/usr/include -I/opt/DVRRDK_04.00.00.03/target/rfs/usr/include/libxml2/ -I/opt/DVRRDK_04.00.00.03/target/rfs/usr/include/freetype2 -I/usr/include/dbus-1.0 -I/opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/lib/dbus-1.0/include -isystem /opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/include/glib-2.0 -I/opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/lib/glib-2.0/include -isystem /opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/include/gstreamer-0.10 -isystem /opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/include/libxml2 -isystem /opt/DVRRDK_04.00.00.03/ti_tools/cgt_a8/arago/linux-devkit/arm-arago-linux-gnueabi/usr/include/freetype2 -I/home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/qtbase/mkspecs/devices/linux-arm-gnueabi-ti-g++ -o verifyspec.o /home/wangbi/workdir_project/workdir_Qt/Qt5.9.1/qt-everywhere-opensource-src-5.9.1/qtbase/config.tests/common/verifyspec/verifyspec.cpp
    > cc1plus: error: unrecognized command line option "-std=gnu++11"
    > Makefile:178: recipe for target 'verifyspec.o' failed
    > make: *** [verifyspec.o] Error 1
    Note: Also available for Linux: linux-clang linux-icc
    
    ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken
    

    is my tool chain old ?

    any idea?
    I need help.....

    Regards.


  • Moderators

    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.


  • Moderators

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



  • @jsulm @ambershark
    Can you tell me where to configure the "-std=gnu++11" ,change it to "-std=c++11"?

    I can't find the configure file.


  • Moderators

    @Alex_wang Does "configure --help" show anything?


  • Moderators

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

  • Moderators

    @Alex_wang What is your target architecture and its CPU?



  • @jsulm

    1 ARM Cortex-A8



  • @jsulm
    8168 arch is ArmV7-a 32bits,



  • @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
    

  • Moderators

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


  • Moderators

    @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?



  • @aha_1980 @jsulm

    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
    

  • Moderators

    @Alex_wang Did you start from a clean state?


  • Moderators

    @Alex_wang Does your new compiler support exceptions and have exception handling enabled?



  • @jsulm

    yes


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.