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

Create embedded QT Gui applications for a Bananapi-M2-Zero



  • Hi everybody

    I try to do that, like I understood it needs 32 bits arm-gnueabihf architecture and qt 4.6.
    I downloaded qt-everywhere-opensource-src-4.6.3 and I tryed to perform (all without parameters):

    ./configure
    make
    make install

    in order to have a valid compiled and installed Qt 4.6, a new created qmake, that I can use in the kit definition in Qt creator.
    I have Ubuntu 20.04

    It looks like they are 64 bis options given when I run ./configure
    g++ -c -m64 -pipe -g -O2 -fPIC -Wall -W -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTSTREAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../../mkspecs/linux-g++-64 -I. -I../../../include -I../../../include/QtCore -I../../../include/QtXml -o .obj/release-static/qfsfileengine_iterator.o ..

    At the end of make command it looks like an error
    /usr/include/x86_64-linux-gnu/sys/inotify.h:34:8: error: flexible array member ‘inotify_event::name’ not at end of ‘struct QMapPayloadNode<int, inotify_event>’
    because a newer incompatible header is called

    What is wrong?, should I give at this step an embedded architecture arm-gnueabihf 32 bits parameter to the command ./configure ?
    should I redefine my PATH to older g++ and included files?
    Like I understood I must have a generic qt 4.6 compiled and the definition of the arm-gnueabihf 32 bits is set after by setting the Kit in qt creator, isnt'it?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Qt 4.6 ? Are you really sure ? Qt 4 has reached end of life a very long time ago and it was at 4.8.7. You should first ensure that you can use a recent Qt 5 release.



  • I have QT 5.12 and I cannot select it in QT creator Kits because it always says that the compiler I downloaded installed and selected g++-arm-gnueabihf 32 bits compatible with the Banana PI M2 zero cannot produce code for this QT version. This is the same for all earlyer versions of QT I downloaded on https://download.qt.io/archive/qt By version 5.1.1 it is possible to have a 32 bit version installer qt-linux-opensource-5.1.1-x86-offline.run The installer doesn't work at the moment, there is an error that I didn't solve at the moment:
    error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory
    This installer look like QT 5.9.9 64 bits that I could install and with an already existing builded qmake for specific architecture(X86). Perhaps it is not important at this step. I would be able to select QT5.1.1 in the Qt creator kit selector and give my arm-gnueabihf architecture in my self created qmake.conf path. Not shure it will work, this installed qt doesnt contain a configure executable like the downloaded qt-everywhere-opensource-src-4.6.3. I will try to generate qmake by using "./configure" in "qt-everywhere-opensource-src-5.1.0.tar.gz" . May be I will have to configure something manually like 32 bits selector and Im not sure at the moment it will success.
    Otherwise I think about using an arm-gnueabihf 64 bits compiler if it exists to use with QT 5.12 but im not sure it will work on my Banana Pi M2 zero on which I installed and updated ubuntu MATE 18.04 LTS

    uname -i

    gives

    armv7l

    getconf LONG_BIT

    gives

    32


  • Lifetime Qt Champion

    Did you saw this guide ?



  • It seems to work.

    After the command make I get the error :

    ssl/qsslcertificate_openssl.cpp:63:30: error: invalid use of incomplete type ‘X509’ {aka ‘struct x509_st’}
    63 | return qHashBits(x509->sha1_hash, SHA_DIGEST_LENGTH, seed);

    I'm not sure if I have to install a previous compatible version of libssl1.0 for armhf.


  • Lifetime Qt Champion

    Which version of Qt are you building exactly now ?
    Which exact version of OpenSSL do you have at hand for your target ?



  • It is qt-everywhere-opensource-src-5.5.1 according to your adviced website, I substituted gnueabi by gnueabihf.
    By default on my PC Ubuntu 20 64 bits is this single file called:
    /usr/bin/openssl : ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=4d2003d01494e5fd39293fdc8379c406d6b641b2, for GNU/Linux 3.2.0, stripped

    Otherwise I have this old version file used by an old system (not arm) with qt 4.8
    ... /platform/sysroot-target/usr/bin/openssl: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.23, with debug_info, not stripped

    A few month ago I compiled the operating system Ubuntu MATE image (BPI-M2P-bsp-4.4) for my BananaPi M2 zero. It was successful and it actually works. I remember I had to create
    /usr/lib/arm-liunx-gnueabihf and put some things into manually regarding the error messages. The compilation of Qt seems to use this folder too. In this folder there is
    /usr/lib/arm-linux-gnueabihf/openssl-1.0.0/engines
    with
    lib4758cca.so
    libaep.so
    libatalla.so
    libcapi.so
    libchil.so
    libcswift.so
    libgmp.so
    libgost.so
    libnuron.so
    libpadlock.so
    libsureware.so
    libubsec.so

    In the package for the os compilation there is

    ... /BPI-M2P-bsp-4.4/sunxi-pack/pctools/linux/openssl
    containing:
    create_toc0
    dragonsecboot
    genrsa
    rec
    rsa
    x509

    there is a sourcecode three in:
    ... /BPI-M2P-bsp-4.4/u-boot-sunxi/lib/openssl

    There is a library three in another operating system package (BPI-M2Z) that I could not compile
    ... /BPI-M2Z/sysroot/usr/lib/arm-linux-gnueabihf/openssl-1.0.0/
    a single library
    ... /BPI-M2Z/sysroot/usr/lib/arm-linux-gnueabihf/ruby/2.5.0/openssl.so
    some pyton sourcecodes in
    ... /BPI-M2Z/sysroot/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl
    some ruby files in
    ... /BPI-M2Z/sysroot/usr/lib/ruby/2.5.0/openssl
    and the same three
    ... /BPI-M2Z-bsp/sunxi-pack/pctools/linux/openssl as in the BPI-M2P-bsp-4.4 package

    Perhaps I need to create a link to the os package libraries.

    I downloaded those packages:
    libssl1.0-dev_1.0.2u-1~deb9u1_armhf.deb
    libssl1.0.2-udeb_1.0.2u-1~deb9u1_armhf.udeb
    libssl1.0-dev_1.0.2n-1ubuntu5.3_armhf.deb
    but the installation fails due to dependancy.

    I downloaded
    openssl-1.0.2k.tar.gz
    which contains a configure executable, I didnt try to compile it at the moment.


  • Lifetime Qt Champion

    Just because the guide mentions 5.5.1, you shouldn't just go blindly with it. Use a recent version of Qt. This one is not supported anymore.



  • I downloaded from

    https://ftp.osuosl.org/pub/blfs/conglomeration/qt5/

    the package

    qt-everywhere-src-5.14.2

    containing a configure executable

    I copied
    /qtbase/mkspecs/linux-arm-gnueabi-g++/
    to
    /qtbase/mkspecs/linux-arm-gnueabihf-g++/
    according to my architecture, and adapted qmake.conf wihth armgnueabi->armgnueabihf
    The command line:
    ./configure -release -opensource -xplatform linux-arm-gnueabihf-g++ -prefix /opt/qt5-arm -no-opengl
    x11 option removed because not supported.
    At the end of the long make there is an error
    libz.so.1, required by /home/eric/qt-everywhere-src-5.14.2/qtbase/lib/libQt5Gui.so not found. I have it on my computer at several places:
    /usr/lib/i386-linux-gnu/libz.so.1
    /usr/lib/x86_64-linux-gnu/libz.so.1
    /usr/lib32/libz.so.1
    How do I specify wich to use?
    Is it in the command line? in qmake.conf? in path? perform a ln -s?


  • Lifetime Qt Champion

    It should be available from your device sysroot.



  • I solved this problem by adding
    QMAKE_LIBS += -lz
    in my qmake.conf.

    But now I have :
    sh: 1: python: not found
    Project ERROR: Building QtQml requires Python.
    make: *** [Makefile:340: module-qtdeclarative-make_first] Error 3

    python is already installed on my computer.


  • Lifetime Qt Champion

    Which version of Python ?



  • python3 -V

    gives

    Python 3.8.2

    ...

    ok solved by

    sudo ln -s python3 python

    in /usr/bin

    ...

    next error is:
    Project ERROR: Unknown module(s) in QT: openglextensions
    make[2]: *** [Makefile:96: sub-render-make_first-ordered] Error 3


  • Lifetime Qt Champion

    QtQuick requires OpenGL but you disabled it.



  • Make for QT 5 arm successful
    Make install successful

    I create a new basic application Qt 5.14.2 Widgets. Ok With default kit.

    When I select arm-linux-gnueabihf I have some compile errors:

    /opt/qt5-arm/include/QtCore/qbasicatomic.h:61:4: error: #error "Qt requires C++11 support"

    /opt/qt5-arm/include/QtCore/qbasicatomic.h:97:23: error: ‘QAtomicOpsSupport’ was not declared in this scope

    /opt/qt5-arm/include/QtCore/qbasicatomic.h:99:14: error: ‘Ops’ has not been declared

    /opt/qt5-arm/include/QtCore/qbasicatomic.h:238:13: error: ‘QAtomicOps’ does not name a type

    /opt/qt5-arm/include/QtCore/qbasicatomic.h:97:51: error: ‘::IsSupported’ has not been declared


  • Lifetime Qt Champion

    Did you properly create a kit using your cross-compiled Qt ?



  • Yes , I added my cross compiled(I remember I had to remove the -no-c++11 of ./configure command because it was not recognized) QT Version Qt 5.14.2(qt5-arm) /opt/qt5-arm/bin/qmake in Qc Kits and it is accepted.
    I added the compilers with the package you give me:
    gcc Linaro
    /home/eric/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-gcc
    g++ Linaro
    /home/eric/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-g++
    I could not add the debugger arm-Debugger from your package
    /home/eric/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-gdb
    It is not recognized by Qc. I selected GDB multiarch(/usr/bin/gdb-multiarch) which I already have.

    Perhaps I should have version 5.14 of compilers and debugger?

    As device I have generic Linux device, Qt mkspec is empty.
    How should I configure the separated device BananaPi M2 Zero connected trough Ethernet with address 192.168.1.110 to my development PC with Ubuntu Linux? Should I create something else as generic Linux Device?

    ...

    Problem solved by selecting most recent compilers.


Log in to reply