[TUTO] Build Qt to cross compile for arm



  • Hello (ou plutôt bonjour ;) )

    After QT is configured, installed, everything is configured in QT creator and i make an application.
    Can i simply copy/paste it in the bin folder of my embedded device or must i copy first some libraries or others stuff on the device ? I tried your tuto and had no problem (aside from a very slow "make"...). I went in QT creator and created a single QT widget application (a window with a button launching a message box), it built in the release folder. But when trying to run it on my board with a ./nameofthefile (and with chmod 755 it) i have an error "applet not found" which make me think either i am missing things on my board or i needed to add somethign to the configuration.

    Still thank you for this help !



  • @wowy
    Hello

    In my case after compiling the app, i copied it on my pcDuino, I didn't have the same problem than you but another one, i've no interface, my application is started ( a tcpclient that connect to a tcpserver over internet ) i receive it's connection on the PC that run the tcp server. But at the launch of the app it prints me two things, the first one libicui18n.so.48 cannot open shared object file no such file or directory and another one releving to DBUS.

    EDIT : Those problems don't come from a bad compilation but from the pcDuino itself, don't worry this tuto is functionnal.

    I'm sorry i can't help you on that point, and i'll only can get back to work on the pcDuino by monday or tuesday next week to solve these 2 problems.

    I only can advice you to google the message the executable prints you.
    I've made a quick research online for you, it seems to be some problem with the PATH or with some links, i'm sorry i can't help on that, i'll edit my main post by next week with my solution for the pcDuino problems.

    Hope you'll find a solution asap.

    Au revoir ;)



  • @koahnig Thank you for the fast answer, it's my pleisure to share that little tuto.
    By the way should I move it to the wiki section ?



  • @Spader42
    On your arm device, do you have a screen/touch screen and needed to use tslib for it ?



  • @Spader42

    Hi, I am sorry to bother you, but could you tell me if I could use that cross-compile toolchain and procedure for a BeagleBone Black running Debian?



  • I am sorry to bother you guys but I'm trying to follow this tutorial and I get stuck in the next part:

    ./configure -opensource...

    I get the following message: "make: g++: Command not found" AND "make: *** [project.o] Error 127
    I am currently working on a ubuntu 64 bits Machine mounted on VirtualBox and my target is a BeagleBone Black running Debian. Take it as if I had no knowledge what so ever because it is practically that way. Any advice that you could give me is greatly appreciated.

    Thank you.



  • I have follow all the steps...and i am able to create a makefile for arm architecture...but getting error in make...i am working on qt5.5


  • Qt Champions 2018

    @citiustech Hi! What is the error you get?



  • do you have any steps for cross compile qt5.5 for arm



  • QOpenglwidget file is included in my application..it is build on qt5.5. but giving file error while make using QT4.8 that QOpenGLWidget no such file.


  • Lifetime Qt Champion

    Hi,

    That's because QOpenGLWidget is a new class of Qt 5. Qt 4 has QGLWidget.



  • Thank for your valueable reply



  • i am trying to build qt5.5 for arm but getting error while build.
    i am using ./configue -xplatform inux-arm-gnueabi-g++ command. it gives openssl error. openssl.h no such file?

    can you please suggest


  • Lifetime Qt Champion

    Unless you specified that you want OpenSSL support it should not stop the build. If you want OpenSSL support then you need to provide that dependencies for your target.



  • DO you have any Build steps like QT4.8.5 for QT5.5?


  • Lifetime Qt Champion

    That usually depends partly on the device you are targeting.



  • i am cross compiling qt for cubieboard 4.
    can you please suggest me ./configure command ?


  • Lifetime Qt Champion

    I don't know this board but a quick search returns this blog entry which step 4 is likely what you are looking for to get started.



  • Hello. The above solution is working fine for no-opengl.
    once opengl es2 enable for cross compile it gives opengl functionality test failed error. i have copied all the GL/GLES2 file from arm board to ubuntu pc and edit qmake.conf file. but it gives the same error.
    how to cross compile qt for arm with opengl. can you please suggest?


  • Lifetime Qt Champion

    The headers are not enough, did you also copied the libraries ?



  • Hello,
    I know this is a late reply, but hopefully someone is still reading this thread and active. I followed all the steps, and have everything setup. I compiled the file, but when I try and run the make I get an error saying their is no such file or directory of QGLWidget.
    I am looking for assistance as to how I can rectify this problem, and finally get my applications building and running. I have included the terminal log below:

    /home/sam/Downloads/qt-everywhere-opensource-src-4.8.5/bin/qmake -spec qt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-arm-gnueabi-g++ CONFIG+=debug -o Makefile ../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting/2dpainting.pro
    /home/sam/Downloads/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -Iqt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-arm-gnueabi-g++ -I../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting -I/usr/local/Qt-4.8.5-arm/include/QtCore -I/usr/local/Qt-4.8.5-arm/include/QtNetwork -I/usr/local/Qt-4.8.5-arm/include/QtGui -I/usr/local/Qt-4.8.5-arm/include/QtOpenGL -I/usr/local/Qt-4.8.5-arm/include -I. -I../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting -I. -o glwidget.o ../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting/glwidget.cpp
    In file included from ../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting/glwidget.cpp:41:0:
    ../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting/glwidget.h:44:21: fatal error: QGLWidget: No such file or directory
    #include <QGLWidget>

    THANKS!!!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you trying to build a Qt 5 example with Qt 4 ?



  • Yes I am, wow I am an idiot.
    If I try to use a qt 4 example should it work?



  • So I am using the proper example now, it compiles, but when I run the make It says:

    make: Nothing to be done for 'first'.

    I have attached the entire command and response below:

    sam@sam-VirtualBox:~/Downloads$ "/home/sam/Downloads/qt-everywhere-opensource-src-4.8.5/bin/qmake" '/home/sam/classwizard/classwizard.pro' -r CONFIG+=debug -spec /home/sam/Downloads/qt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-arm-gnueabi-g++
    sam@sam-VirtualBox:~/Downloads$ make
    make: Nothing to be done for `first'.


  • Lifetime Qt Champion

    Did you cross-compile Qt ? If so did you install it ?



  • I thought I built it for ARM and it would just run on its own.
    Do I need Qt installed on my ARM hardware?
    When I move the folder to my ARM hardware I get this error when I try to run it:
    ./classwizard: undefined symbol: _ZN7QWidget8qwsEventEP8QSEvent


  • Lifetime Qt Champion

    Looks like you cross-compiled your application with Qt 4 and try to run it against Qt 5.



  • I have Qt 4 on my arm device, but I am still getting the same error. Not sure what to do here?
    I have Qt 4 on Raspbian on a Raspberry Pi 3 model B.
    Not sure why this error keeps coming up.


  • Lifetime Qt Champion

    Because the Qt 4 you have installed with Raspbian is a standard Qt build for ARM not a Qt for embedded device build.

    You have have to cross-compile your Qt 4 again without the embedded option.



  • But the Qt I have on my linux where I built the project is for ARM. Its the one for this project.
    So should I just use the build from this post on my pi?


  • Lifetime Qt Champion

    I didn't say the contrary: both builds are valid. The one you have on your desktop machine is a Qt For Embedded Linux build which uses QWS while on your Raspbian you have a standard as in "desktop standard" build of Qt 4.

    It depends on how you want to use your application on your Pi. If its the QWS functionality that you need then you have to install your self-built Qt 4 on the Pi.



  • What if I just created a deb package on my Linux machine, and then used that on the Pi?
    Or is it better to just do the custom build? (really dont want to do that painful process)
    Is this a guide I can use as a base for this build?:
    http://processors.wiki.ti.com/index.php/Building_Qt_with_OpenGL_ES_accelerated_by_SGX



  • So I managed to compile and run a Hello World project. Creating the make and executable on my Linux with this ARM build. Then moving it onto the Pi and running it. But when I try anything more complex I am getting the same error.


  • Lifetime Qt Champion

    Again: this is an Qt for Embedded Linux build see the -embedded arm configure option. Thus my question, are you going to use the X Server of your Pi ?

    If yes, you have to rebuild Qt without the embedded options but keep the ARM target.

    If no, then one basic option is to copy the content of the cross-compiled Qt installation folder over to your Pi at the same place and you should be good to go (you can later remove stuff like the host tools headers etc.)



  • How can I do this compilation with opengl?


  • Lifetime Qt Champion

    Which version of Qt are you currently using ?



  • Execute this command to install Qt in the /usr/local/Qt-4.8.5-arm/ directory : ./configure -opensource -confirm-license -prefix /usr/local/Qt-4.8.5-arm -embedded arm -little-endian -no-pch -xplatform qws/linux-arm-gnueabi-g++

    In this step Did you create /usr/local/Qt-4.8.5-arm/ directory ? or Did created by qt creator when installitaion?



  • This post is deleted!


  • Hi,

    I am not understood that fourth step,

    Go to /home/<yourUserName>/
    Execute this command to install Qt in the /usr/local/Qt-4.8.5-arm/ directory : ./configure -opensource -confirm-license -prefix /usr/local/Qt-4.8.5-arm -embedded arm -little-endian -no-pch -xplatform qws/linux-arm-gnueabi-g++
    qt-everywhere-opensource-src-4.8.5/

    why beacuse,when i go /home/<username> there is no such file called (this present in installQt directory) and in /usr/local also not present the Qt-4.8.5

    anyone help how to processed next..
    thankyou


  • Qt Champions 2018

    @asha You should not copy the steps exactly, you have to adapt them to your environment:
    Go to /home/<yourUserName>/ - this means go to your home directory
    Qt-4.8.5 - change that to the Qt version you want to compile.