Skip to main content
Visitor II
June 14, 2019
Question

STM32 Qt cross compile

  • June 14, 2019
  • 6 replies
  • 6193 views

Hello,

I have a STM32MP157C-DK2 board and did the hello world cross compile project with GTK and that work perfectly.

Now I am trying to do cross compiling with Qt Creator. I used the same compiler as the GTK project but Qt Creator give me an error: The compiler (arm-linux-generic-elf-32bit) cannot produce code for the Qt version (x86-linux-generic-elf-64bit).

Where I get a compatible qmake file for this compiler or how to generate it?

Regards Marius

    This topic has been closed for replies.

    6 replies

    Technical Moderator
    June 14, 2019

    Hello,

    don't know if it is similar, but have you looked at this post ?

    Visitor II
    June 14, 2019

    You should have qmake inside your toolchain.

    Perhaps you forgot to setup the cross compiler environment before calling it with QtCreator?

    --

    Marco Cavallini | KOAN sas | Bergamo - Italia

    embedded software engineering

    http://KoanSoftware.com

    MariusAuthor
    Visitor II
    June 17, 2019

    Thanks for your reply @koan​ .

    There is no qmake file in the SDK.

    I have no cross compiler environment because I only want to use QtCreator for developing.

    Which Toolchain is for this board and include a qmake file?

    Visitor II
    June 17, 2019

    Hi Marius,

    as you may know, QtCreator is mainly inteded to be used for Qt development.

    Setup QtCreator for GTK is very difficult and if you really med an IDE in this case I suggest to use Eclipse or Visual Studio Code.

    --

    Marco Cavallini | KOAN sas | Bergamo - Italia

    embedded software engineering

    http://KoanSoftware.com

    MariusAuthor
    Visitor II
    July 2, 2019

    After many attempts I managed to generate a qMake file with qt-everywhere 4.8. (worked with this tutorial)

    There are no Qt librarys installed on the STM32MP157C-DK2 board. After running my compiled Hello World application I got an error saying that libqtgui4 is missing.

    Then I started to build an image with Qt5 librarys. It took many hours but in the end it worked. (this tutorial )

    I installed the image on my board and started the sample projects with Qt. It worked, the Qt5 librarys were installed. When I ran my Hello World project the same error occurred. I think it is because my Hello World application was built with Qt 4.8 and the image contains Qt 5.11 librarys.

    So I have to create a Qt 5.11 project. In my virtual machine (Ubuntu 18.04) I installed qt-everywhere 5.11.2 and took the "gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf" compiler. My configuration options are these here:

    ./configure -opensource -confirm-license -prefix /usr/local/Qt-5.11.2-arm -xplatform linux-arm-gnueabi-g++

     My qmake.conf looks like these:

    #
    # qmake configuration for building with arm-linux-gnueabi-g++
    #
     
    MAKEFILE_GENERATOR = UNIX
    CONFIG += incremental
    QMAKE_INCREMENTAL_STYLE = sublib
     
    include(../common/linux.conf)
    include(../common/gcc-base-unix.conf)
    include(../common/g++-unix.conf)
     
    # modifications to g++.conf
    QMAKE_CC = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
    QMAKE_CXX = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
    QMAKE_LINK = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
    QMAKE_LINK_SHLIB = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
     
    # modifications to linux.conf
    QMAKE_AR = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar cqs
    QMAKE_OBJCOPY = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-objcopy
    QMAKE_NM = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -P
    QMAKE_STRIP = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip
     
    load(qt_config)

    The paths to my compiler are correct, I already checked this.

    I get the following error when running the upper ./configure command

    Note: Also available for Linux: linux-clang linux-icc
     
    Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
     
    ERROR: The OpenGL functionality tests failed!
    You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
    QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.

    How can i fix this error?

    I'm happy about every answer.

    Visitor II
    July 4, 2019

    Hello @Marius​ 

    I suggest you to follow an easier way adopting our new configuration of the Yocto Project build system

    See our recent post about it : http://www.koansoftware.com/en/content/yocto-project-meta-layer-stm32mp1-koan

    Let me know if it works on your side too.

    --

    Marco Cavallini | KOAN sas | Bergamo - Italia

    embedded software engineering

    http://KoanSoftware.com

    Visitor II
    August 12, 2019

    HI Koan,

    thanks for the link but why is it broken now ?

    Visitor II
    August 12, 2019

    @IYetk​ Thank you for pointing out the problem.

    We just renewed our website and some links are missing.

    Now I restored the missing link above and however it now redirects to the official page.

    https://koansoftware.com/yocto-project-meta-layer-for-stm32mp1-by-koan/

    I hope that this may be useful for you.

    Best regards

    --

    Marco Cavallini | KOAN sas | Bergamo - Italia

    embedded software engineering

    https://KoanSoftware.com