Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. Cross Compiling Qt onto Pi problems
QtWS25 Last Chance

Cross Compiling Qt onto Pi problems

Scheduled Pinned Locked Moved QtonPi
17 Posts 4 Posters 6.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hyprodimus Prime
    wrote on last edited by
    #1

    Hello, I have been searching around for the best way to be able to develop on the Pi. My programs are Qt based, and take a while to compile on the Pi itself (qt 4). I decided that I need to cross compile. There are many links that have told me similar things.

    http://www.ics.com/blog/building-qt-5-raspberry-pi
    https://www.youtube.com/watch?v=I2vmh0dMzEw
    http://exploreembedded.tumblr.com/post/ ... spberry-pi

    Essentially I need:

    • QT5 sources
    • Toolchain (https://github.com/raspberrypi/tools/)
    • Raspbian image

    I used VirtualBox to put Ubuntu on my windows PC. Then i installed QT creator and QT5 for Ubuntu. I get confused where they say I need a new Raspbian image and I need to mount it. **What does mounting the image do? **Can I just take the SD card I am already using? I feel like Im playing with Russian Dolls with my operating systems. Raspbian in Ubuntu in Windows....

    I already have qt4 on my Pi, so do i need to build qt5 from source? I hear that takes a long time. Do I need to copy those files over from my Pi to Ubuntu?

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      "mounting the image" is essentially the same as mounting an USB mass storage device (or any other storage for that matter).

      Yes, you can use your SD Card.

      If you want to use Qt 5, then yes you have to cross-compile it first. It can take a long time if your computer is slow. It's really slow if you compile it natively on the Pi.

      The copying part will take place automatically when you call make install

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hyprodimus Prime
        wrote on last edited by
        #3

        Thanks for the reply.

        I am getting confused as to which parts parts of the tutorials are done on the Pi, and which are done on the Ubuntu side. I was able to mount the raspberry pi image which has qt4 on it.

        In Qt Creator, I need the Qt version, and the compiler. I am having trouble knowing which to pick.

        I was able to cross compile a non-Qt hello world program using this tutorial. http://jeremy-nicola.info/portfolio-item/cross-compilation-distributed-compilation-for-the-raspberry-pi/
        But that was using the compiler on the Ubuntu side. Is the reason that I have to build and mount Qt on the Pi because I have to navigate to the Qt version on the Pi img?

        I tried to add the qmake from the Pi and it gives me this error,* "The qmake executable /home/bradley/SharedWindows/img2/usr/bin/qmake-qt4 could not be added: Cannot start "/home/bradley/SharedWindows/img2/usr/bin/qmake-qt4": Exec format error"*

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It's a native Qt 4 that you have on your Pi filesystem, it won't run your desktop. To cross-compile you need to have your Pi root file system mounted as it provides with the necessary libraries.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • H Offline
            H Offline
            Hyprodimus Prime
            wrote on last edited by
            #5

            I have the Pi root file system mounted and I am able to navigate through. Which library files am I looking for? Do these go under the Qt Version setting or the compiler setting?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Did you call make install after you cross-compiled Qt ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • H Offline
                H Offline
                Hyprodimus Prime
                wrote on last edited by
                #7

                Forgive me if this sounds stupid, but if I have Qt4 installed on the Pi from downloading the binaries (https://wiki.qt.io/Apt-get_Qt4_on_the_Raspberry_Pi), then I didnt think I needed to compile Qt again. Does that package not have what is required?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Again, it's the native package for the Pi so compiled for ARM including the tools like qmake, you can use it directly on the Pi but not on your desktop machine (the error you got earlier comes from that)

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    Hyprodimus Prime
                    wrote on last edited by
                    #9

                    Ok, I think I got a little bit further. I have done this tutorial

                    http://www.hertaville.com/cross-compiling-qt4-app.html

                    I was able to mount the RPi root system, and I am on the example part. There isnt a make file on that page. There is an image though. After the word "make" in the command line, there is a lot of text. This is essentially the make file right?

                    I am trying to apply what I have now with qt creator and looking at the Configuring Qt Creator part here, http://raspberry-qt.org/#binaries

                    Im at the line, "Click "Add..." and select "/usr/local/qt5pi/bin/qmake""
                    and its saying I need to run make install. You mentioned that before. But if I try to do that, it says,

                    bradley@bradley-VirtualBox:~/rpi/2013-03-22-raspberry-qt/qt5pi/bin$ make install
                    make: *** No rule to make target `install'. Stop.

                    And if I wanted to use qt4, then I need the qt4 folder like that theirs. what is it? How did they create that folder? Is it just downloaded from the qt website?

                    Thank you for all of the guidance!

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      You should call make install in the same folder you called make before.

                      Qt 4 is natively build for ARM. Raspbian is a Debian derivative and thus gives access to a lot of packages. However if you want to use your desktop computer to build Qt 4 application for the Raspberry Pi you again need to first cross-compile Qt 4.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • H Offline
                        H Offline
                        Haresh
                        wrote on last edited by
                        #11

                        hello SGaist,
                        I have gone through many guides to cross compile QT4 on x86 but none is complete
                        so please if possible can you explain the procedure to cross compile QT4 for ARM
                        sorry for my english.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          What did you do ? What didn't work ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • H Offline
                            H Offline
                            Haresh
                            wrote on last edited by
                            #13

                            hello,
                            I have followed this link

                            http://www.hertaville.com/cross-compiling-qt4-app.html

                            but it is using make file for cross compiling the application whereas I want to build Qmake and configure Qt Creator for cross compilation.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              Did you first cross-compile Qt 4 ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • P Offline
                                P Offline
                                PMik
                                wrote on last edited by PMik
                                #15

                                Hi! I have a problem with configuration Qt5 on Raspberry Pi with Raspbian. I follow this instruction: https://wiki.qt.io/Native_Build_of_Qt5_on_a_Raspberry_Pi and after I called instruction ./configure -v -opengl es2 -device linux-rasp-pi-g''+ -device-option CROSS_COMPILE=/usr/bin/ -opensource
                                -confirm-license -optimized-qmake -reduce-exports -release -qt-pcre -make libs -prefix /usr/local/qt5 &> output, the process didn't stop. I was waiting about 1 hour and process 'cc1plus' still was performing, so is there other way to configure qt5 for cross-compile?

                                Note: I didn't use patch file from the instruction.

                                Edit: I switched off Raspberry and next day, the same instruction took few seconds. But I'm not sure if the 'output' file is ok. my output looks diffrent than output file from the example in instruction, is that normal?
                                But there is other problem: next instuction: 'make &> output_make' takes few hours and it did't stop so I killed it. This time output_make file is very big and it's growing while processing, so how long should it process?

                                1 Reply Last reply
                                0
                                • H Offline
                                  H Offline
                                  Hyprodimus Prime
                                  wrote on last edited by
                                  #16

                                  I tried cross compiling Qt 5, And I got about 2 hours into it when I got this message.
                                  I dont really know what this means. Did it complete? What do the error 1 and 2s mean?

                                  ../../../../mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp:95:68: error: declaration of C function ‘int vc_dispmanx_element_change_attributes(DISPMANX_UPDATE_HANDLE_T, DISPMANX_ELEMENT_HANDLE_T, uint32_t, int32_t, uint8_t, const VC_RECT_T, const VC_RECT_T*, DISPMANX_RESOURCE_HANDLE_T, VC_IMAGE_TRANSFORM_T)’ conflicts with
                                  In file included from /mnt/raspberry-rootfs/opt/vc/include/EGL/eglplatform.h:110:0,
                                  from /mnt/raspberry-rootfs/opt/vc/include/EGL/egl.h:36,
                                  from ./qeglfshooks.h:48,
                                  from ../../../../mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp:42:
                                  /mnt/raspberry-rootfs/opt/vc/include/interface/vmcs_host/vc_dispmanx.h:108:22: error: previous declaration ‘int vc_dispmanx_element_change_attributes(DISPMANX_UPDATE_HANDLE_T, DISPMANX_ELEMENT_HANDLE_T, uint32_t, int32_t, uint8_t, const VC_RECT_T*, const VC_RECT_T*, DISPMANX_RESOURCE_HANDLE_T, DISPMANX_TRANSFORM_T)’ here
                                  ../../../../mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp:195:10: warning: unused parameter ‘window’ [-Wunused-parameter]
                                  In file included from ../../../../mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp:42:0:
                                  ./qeglfshooks.h:74:21: warning: ‘hooks’ defined but not used [-Wunused-variable]
                                  make[4]: *** [.obj/release-shared/qeglfshooks_pi.o] Error 1
                                  make[4]: Leaving directory /home/bradley/raspberry/qt-everywhere-opensource-src-5.0.2/qtbase/src/plugins/platforms/eglfs' make[3]: *** [sub-eglfs-make_first] Error 2 make[3]: Leaving directory /home/bradley/raspberry/qt-everywhere-opensource-src-5.0.2/qtbase/src/plugins/platforms'
                                  make[2]: *** [sub-platforms-make_first] Error 2
                                  make[2]: Leaving directory /home/bradley/raspberry/qt-everywhere-opensource-src-5.0.2/qtbase/src/plugins' make[1]: *** [sub-plugins-make_first] Error 2 make[1]: Leaving directory /home/bradley/raspberry/qt-everywhere-opensource-src-5.0.2/qtbase/src'
                                  make: *** [sub-src-make_first] Error 2
                                  bradley@bradley-VirtualBox:~/raspberry/qt-everywhere-opensource-src-5.0.2/qtbase$ ^C
                                  bradley@bradley-VirtualBox:~/raspberry/qt-everywhere-opensource-src-5.0.2/qtbase$ ^C
                                  bradley@bradley-VirtualBox:~/raspberry/qt-everywhere-opensource-src-5.0.2/qtbase$ ^C
                                  bradley@bradley-VirtualBox:~/raspberry/qt-everywhere-opensource-src-5.0.2/qtbase$*

                                  1 Reply Last reply
                                  0
                                  • H Offline
                                    H Offline
                                    Hyprodimus Prime
                                    wrote on last edited by
                                    #17

                                    So....after running into more problems with the other online tutorials, I went back to the original Qt wiki tutorial. When I first looked at it months back, I couldnt follow it through, so I looked for other ways. This time, I was able to understand and navigate through the steps. I can now cross compile Qt programs from my Windows PC!
                                    I used Ubuntu in VirtualBox, with a Raspbian image mounted! (Raspbian->Ubuntu->Windows)->Raspbian

                                    Thanks for the help here on the forums. Its been months of reading and learning about linux.

                                    For anyone who wants to do the same, you can contact me.

                                    I did notice two things not mentioned on the wiki page.
                                    First, that there was a path error. Wherever it uses "/mnt/rasp-pi-rootfs", it should be "~/opt/mnt/rasp-pi-rootfs"

                                    I wouldnt have known how to spot the error or how to fix it without the arduous process of learning linux.

                                    Second, after you unmount the root filesystem after cross compiling Qt5 and put it onto the SD card, the Raspberry will not boot. Dont worry, just do what it asks:
                                    password, then type "fsck"

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved