Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

qt-5.15.0: cross-compile with gcc-4.9



  • Hello!
    I try cross-compile Qt-5.15.0 with gcc-4.9

    $ toolchain/arm-histbv310-linux/bin/arm-histbv310-linux-g++ -dumpversion
    4.9.2
    

    At configuration stage I pass use C++11 standart, configuration is success

    Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
    Building for: devices/linux-arm-hisilicon-hi3798mv100-g++ (arm, CPU features: neon)
    Target compiler: gcc 4.9.2
    Configuration: cross_compile compile_examples enable_new_dtags force_debug_info largefile neon silent shared shared rpath release c++11 concurrent reduce_exports separate_debug_info stl
    Build options:
      Mode ................................... release (with debug info)
      Optimize release build for size ........ no
      Building shared libraries .............. yes
      Using C standard ....................... C11
      Using C++ standard ..................... C++11
      Using ccache ........................... no
      Using new DTAGS ........................ yes
      Generating GDB index ................... no
      Relocatable ............................ yes
      Using precompiled headers .............. no
      Using LTCG ............................. no
      Target compiler supports:
        NEON ................................. yes
      Build parts ............................ libs
    ..........
    

    But buid is fail

    .................
    compiling /tmp/firmware/_dependencies/qtbase/src/corelib/global/qhooks.cpp
    In file included from ../../include/QtCore/qmetatype.h:1:0,
                     from ../../include/QtCore/../../../../_dependencies/qtbase/src/cor
    elib/kernel/qobject.h:54,
                     from ../../include/QtCore/qobject.h:1,
                     from ../../include/QtCore/../../../../_dependencies/qtbase/src/cor
    elib/io/qiodevice.h:45,
                     from ../../include/QtCore/qiodevice.h:1,
                     from ../../include/QtCore/../../../../_dependencies/qtbase/src/cor
    elib/io/qfiledevice.h:43,
                     from ../../include/QtCore/qfiledevice.h:1,
                     from ../../include/QtCore/../../../../_dependencies/qtbase/src/cor
    elib/io/qfile.h:44,
                     from ../../include/QtCore/qfile.h:1,
                     from ../../include/QtCore/../../../../_dependencies/qtbase/src/cor
    elib/io/qfileinfo.h:43,
                     from ../../include/QtCore/qfileinfo.h:1,
                     from ../../include/QtCore/../../../../_dependencies/qtbase/src/cor
    elib/io/qdir.h:44,
                     from ../../include/QtCore/qdir.h:1,
                     from /tmp/firmware/_dependencies/qtbase/src/corelib/global/qlibrar
    yinfo.cpp:41:
    ../../include/QtCore/../../../../_dependencies/qtbase/src/corelib/kernel/qmetatype.
    h: In instantiation of 'QtMetaTypePrivate::QSequentialIterableImpl::QSequentialIter
    ableImpl(const T*) [with T = QList<QVariant>]':
    ../../include/QtCore/../../../../_dependencies/qtbase/src/corelib/kernel/qvariant.h:772:139:   required from here
    ../../include/QtCore/../../../../_dependencies/qtbase/src/corelib/kernel/qmetatype.h:1160:153: error: ambiguous class template instantiation for 'struct QtMetaTypePrivate::ContainerCapabilitiesImpl<QList<QVariant>, void>'
           , _iteratorCapabilities(ContainerAPI<T>::IteratorCapabilities | (1 << 4) | (ContainerCapabilitiesImpl<T>::ContainerCapabilities << (4+3)))
                                                                                                                                                             ^
    ...........
    

    How can I fix this?
    Thank you.

    P.S. Unfortunately I can't upgrade toolchain now.



  • @debian How to pass C++ 11 compiler?
    I met the simlar problem, I can't change the crosscompiler(my version is also 4.9.2), I crosscompiled the sourcecode of Qt5.14.0,Qt5.14.1,Qt5.14.2 and Qt5.15.0. The configure is ok, but can't pass making. the error message is :

    In file included from ../../include/QtCore/qbasicatomic.h:1:0,
    from ../../include/QtCore/../../src/corelib/thread/qatomic.h:46,
    from ../../include/QtCore/qatomic.h:1,
    from global/qglobal.h:1304,
    from global/qt_pch.h:56:
    ../../include/QtCore/../../src/corelib/thread/qbasicatomic.h:61:4: error: #error "Qt requires C++11 support"

    error "Qt requires C++11 support

    If I use the 7.5 version of crosscompile, It's ok.


  • Lifetime Qt Champion

    @sonicss "Using C++ standard ..................... C++11" - C++11 is already activated. But it looks like you can't build Qt 5.15 with GCC 4.9.
    See https://doc.qt.io/qt-5/supported-platforms.html
    "Generic Linux x86 and x86_64 GCC (5 or later), ICC 18.x" - looks like you need at least GCC 5.



  • Hello, @sonicss !
    I pass C++ standart at configure step via -c++std parameters.
    I was have same error #error "Qt requires C++11 support", I patch source for fix it

    $ git diff src/
    diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
    index ebffe74188..0f5e71b4de 100644
    --- a/src/corelib/global/qcompilerdetection.h
    +++ b/src/corelib/global/qcompilerdetection.h
    @@ -912,7 +912,7 @@
     #         define Q_COMPILER_REF_QUALIFIERS
     #      endif
     #    endif
    -#    if Q_CC_GNU >= 500
    +#    if Q_CC_GNU >= 409
            /* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole
             * 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */
     #      define Q_COMPILER_CONSTEXPR
    


  • @jsulm , why we are can't use GCC-4.9 if src/corelib/global/qcompilerdetection.h check many versions of GCC from GCC-4.3?


  • Lifetime Qt Champion

    @debian Which Qt version?



  • @jsulm , now I use Qt-5.12.6 and I try upgrade it to Qt-5.15.0 because it have some important fixes.



  • @jsulm Thanks a lot



  • @debian Thanks, I will make a try.



  • @debian I read the file:
    qcompilerdetection.h

    #    if Q_CC_GNU >= 500
           /* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole
            * 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */
    #      define Q_COMPILER_CONSTEXPR
    #    endif
    

    I think the new version of qt use constexpr, and the 4.x version of gcc has a bug in it. so can't use the version below 5 of gcc.



  • @sonicss , I think more correct check this at configure stage and why Qt enable different features for different versions of the GCC?
    https://github.com/qt/qtbase/blob/5.15.0/src/corelib/global/qcompilerdetection.h#L839
    Why minimal version is the GCC-4.3 if I can build Qt only with GCC-5 and above?



  • @debian I compared the file (qcompilerdetection.h) in Qt 5.12.8 and Qt5.15.0, the positon of Macro Q_COMPILER_CONSTEXPR is different, so I put this Macro to Q_CC_GNU >= 406, and make the Qt 5.15.0, It still have some errors. But the errors are different.
    something like belows:

    In file included from ../../include/QtCore/qmetatype.h:1:0,
                     from ../../include/QtCore/../../src/corelib/kernel/qobject.h:54,
                     from ../../include/QtCore/qobject.h:1,
                     from ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:46,
                     from ../../include/QtCore/qcoreapplication.h:1,
                     from global/qt_pch.h:66:
    ../../include/QtCore/../../src/corelib/kernel/qmetatype.h: In instantiation of 'QtMetaTypePrivate::QSequentialIterableImpl::QSequentialIterableImpl(const T*) [with T = QList<QVariant>]':
    ../../include/QtCore/../../src/corelib/kernel/qvariant.h:772:139:   required from here
    ../../include/QtCore/../../src/corelib/kernel/qmetatype.h:1160:135: error: ambiguous class template instantiation for 'struct QtMetaTypePrivate::ContainerCapabilitiesImpl<QList<QVariant>, void>'
           , _iteratorCapabilities(ContainerAPI<T>::IteratorCapabilities | (1 << 4) | (ContainerCapabilitiesImpl<T>::ContainerCapabilities << (4+3)))
                                                                                                                                           ^
    In file included from ../../include/QtCore/qmetatype.h:1:0,
                     from ../../include/QtCore/../../src/corelib/kernel/qobject.h:54,
                     from ../../include/QtCore/qobject.h:1,
                     from ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:46,
                     from ../../include/QtCore/qcoreapplication.h:1,
                     from global/qt_pch.h:66:
    ../../include/QtCore/../../src/corelib/kernel/qmetatype.h:1007:8: error: candidates are: struct QtMetaTypePrivate::ContainerCapabilitiesImpl<Container, decltype (declval<Container>().push_back(declval<typename Container::value_type>()))>
     struct ContainerCapabilitiesImpl<Container, decltype(std::declval<Container>().push_back(std::declval<typename Container::value_type>()))>
    
    


  • @sonicss , error is same, error position is not important, possible reason - different number of the build threads.




Log in to reply