Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Cross compile from Ubuntu Desktop to Raspberry Pi 2
Forum Updated to NodeBB v4.3 + New Features

Cross compile from Ubuntu Desktop to Raspberry Pi 2

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
22 Posts 10 Posters 12.3k Views 3 Watching
  • 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 hubaiz

    I managed to cross compile Qt 5.8 for the Raspberry Pi 3 (latest Raspbian) with the xbomber tip from this post (at the end): https://github.com/raspberrypi/tools/issues/50
    Was following the EGLFS guide ( https://wiki.qt.io/RaspberryPi2EGLFS ) on a Linux Mint 17.3 x64 virtual machine.
    I used the linux-rasp-pi2-g++ device configuration and the arm-rpi-4.9.3-linux-gnueabihf toolchain.
    Used the Qt 5.8 source tar.gz without the qtserialbus and qtwebengine

    F Offline
    F Offline
    Fifkie
    wrote on last edited by
    #12

    @hubaiz Looking promising!
    I just wonder, the second script, is there anything else i need to change than the path to tools and sysroot when targeting qt5.8 and raspberry 3?

    i changed the paths and ran the script in qtbase but got errors.

    Running configuration tests...
    Checking for valid makespec... 
    + cd /home/christian/raspi/qtbase/config.tests/common/verifyspec && /home/christian/raspi/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console" "QMAKE_CFLAGS += --sysroot=/home/christian/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/christian/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/christian/raspi/sysroot" -early "CONFIG += cross_compile" /home/christian/raspi/qtbase/config.tests/common/verifyspec
    + cd /home/christian/raspi/qtbase/config.tests/common/verifyspec && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
    > rm -f verifyspec.o
    > rm -f *~ core *.core
    > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -pipe -marm -mfpu=vfp -mtune=arm1176jzf-s -march=armv6zk -mabi=aapcs-linux -mfloat-abi=hard --sysroot=/home/christian/raspi/sysroot --sysroot=/home/christian/raspi/sysroot -O2 -std=gnu++11 -Wall -W -fPIC  -I. -I/home/christian/raspi/qtbase/mkspecs/devices/linux-rasp-pi-g++ -o verifyspec.o verifyspec.cpp
    > cp: cannot stat 'home/christian/raspi/sysroot/usr/lib/arm-linux-gnueabihf/crt*': No such file or directory
    > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wl,-rpath-link,/home/christian/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/christian/raspi/sysroot/usr/lib/ -Wl,-rpath-link,/home/christian/raspi/sysroot/lib/ -mfloat-abi=hard --sysroot=/home/christian/raspi/sysroot --sysroot=/home/christian/raspi/sysroot -Wl,-O1 -o verifyspec verifyspec.o    
    > cp: cannot stat 'home/christian/raspi/sysroot/usr/lib/arm-linux-gnueabihf/crt*': No such file or directory
    > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
    > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
    > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
    > collect2: error: ld returned 1 exit status
    > Makefile:65: recipe for target 'verifyspec' failed
    > make: *** [verifyspec] Error 1
    Note: Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
    
    ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
    
    

    Got any idea whats wrong?

    S 1 Reply Last reply
    0
    • F Fifkie

      @hubaiz Looking promising!
      I just wonder, the second script, is there anything else i need to change than the path to tools and sysroot when targeting qt5.8 and raspberry 3?

      i changed the paths and ran the script in qtbase but got errors.

      Running configuration tests...
      Checking for valid makespec... 
      + cd /home/christian/raspi/qtbase/config.tests/common/verifyspec && /home/christian/raspi/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console" "QMAKE_CFLAGS += --sysroot=/home/christian/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/christian/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/christian/raspi/sysroot" -early "CONFIG += cross_compile" /home/christian/raspi/qtbase/config.tests/common/verifyspec
      + cd /home/christian/raspi/qtbase/config.tests/common/verifyspec && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
      > rm -f verifyspec.o
      > rm -f *~ core *.core
      > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -pipe -marm -mfpu=vfp -mtune=arm1176jzf-s -march=armv6zk -mabi=aapcs-linux -mfloat-abi=hard --sysroot=/home/christian/raspi/sysroot --sysroot=/home/christian/raspi/sysroot -O2 -std=gnu++11 -Wall -W -fPIC  -I. -I/home/christian/raspi/qtbase/mkspecs/devices/linux-rasp-pi-g++ -o verifyspec.o verifyspec.cpp
      > cp: cannot stat 'home/christian/raspi/sysroot/usr/lib/arm-linux-gnueabihf/crt*': No such file or directory
      > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wl,-rpath-link,/home/christian/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/christian/raspi/sysroot/usr/lib/ -Wl,-rpath-link,/home/christian/raspi/sysroot/lib/ -mfloat-abi=hard --sysroot=/home/christian/raspi/sysroot --sysroot=/home/christian/raspi/sysroot -Wl,-O1 -o verifyspec verifyspec.o    
      > cp: cannot stat 'home/christian/raspi/sysroot/usr/lib/arm-linux-gnueabihf/crt*': No such file or directory
      > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
      > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
      > /home/christian/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
      > collect2: error: ld returned 1 exit status
      > Makefile:65: recipe for target 'verifyspec' failed
      > make: *** [verifyspec] Error 1
      Note: Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
      
      ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
      
      

      Got any idea whats wrong?

      S Offline
      S Offline
      shymaxtic
      wrote on last edited by
      #13

      @Fifkie Have you fix this error?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        StoatPatronus
        wrote on last edited by
        #14

        I ran into this a few weeks ago when upgrading from Qt 5.7 to 5.8 and following the wiki's instructions. I added -skip qtwebengine -no-icu when I ran ./configure because I don't need those features in my app and it worked fine after that.

        F 1 Reply Last reply
        0
        • S StoatPatronus

          I ran into this a few weeks ago when upgrading from Qt 5.7 to 5.8 and following the wiki's instructions. I added -skip qtwebengine -no-icu when I ran ./configure because I don't need those features in my app and it worked fine after that.

          F Offline
          F Offline
          Fifkie
          wrote on last edited by
          #15

          @StoatPatronus Did you put it in the script? I get an error when i try to run it:

          ERROR: Unknown command line option '-skip'.
          

          Have tried to put in the beginning and in the end of the script, but i guess as long it doesn't know what it is that does not matter.

          jsulmJ 1 Reply Last reply
          0
          • F Fifkie

            @StoatPatronus Did you put it in the script? I get an error when i try to run it:

            ERROR: Unknown command line option '-skip'.
            

            Have tried to put in the beginning and in the end of the script, but i guess as long it doesn't know what it is that does not matter.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #16

            @Fifkie Can you show your script?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            F 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Fifkie Can you show your script?

              F Offline
              F Offline
              Fifkie
              wrote on last edited by
              #17

              @jsulm Sure!

              It's this script:

              #!/bin/sh
              ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/marco/Qt/5.3/tools-master/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /home/marco/Qt/5.3/sysroot -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi -v
              

              With the "-skip qtwebengine -no-icu" added. I've tried right in the beginning after ./configure, in the end and after "-opensource". Neither worked.

              S 1 Reply Last reply
              0
              • 8 Offline
                8 Offline
                805Badger
                wrote on last edited by
                #18

                @Fifkie

                I was having the same issue and reconfigured with just the -no-icu flag and everything worked fine (I use qtwebengine in my app) my config string is as follows...

                ./configure -release -opengl es2 -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -no-icu -hostprefix ~/raspi/qt5 -v

                1 Reply Last reply
                0
                • F Fifkie

                  @jsulm Sure!

                  It's this script:

                  #!/bin/sh
                  ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/marco/Qt/5.3/tools-master/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /home/marco/Qt/5.3/sysroot -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi -v
                  

                  With the "-skip qtwebengine -no-icu" added. I've tried right in the beginning after ./configure, in the end and after "-opensource". Neither worked.

                  S Offline
                  S Offline
                  StoatPatronus
                  wrote on last edited by
                  #19

                  @Fifkie Here's my command line, please replace the {{ stuff in brackets }} with the paths for your system:

                  ./configure -release -opengl es2 -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE={{pi_folder}}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot {{pi_folder}}/sysroot -opensource -confirm-license -skip qtwebengine -no-icu -make libs -prefix /usr/local/qt5pi -extprefix {{pi_folder}}/qt5pi -hostprefix {{pi_folder}}/qt5

                  One thing I noticed in the config string you posted is it looks like Qt 5.3 (/home/marco/Qt/5.3/...etc) which I haven't tried - I only tried with 5.8.

                  F 1 Reply Last reply
                  0
                  • S StoatPatronus

                    @Fifkie Here's my command line, please replace the {{ stuff in brackets }} with the paths for your system:

                    ./configure -release -opengl es2 -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE={{pi_folder}}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot {{pi_folder}}/sysroot -opensource -confirm-license -skip qtwebengine -no-icu -make libs -prefix /usr/local/qt5pi -extprefix {{pi_folder}}/qt5pi -hostprefix {{pi_folder}}/qt5

                    One thing I noticed in the config string you posted is it looks like Qt 5.3 (/home/marco/Qt/5.3/...etc) which I haven't tried - I only tried with 5.8.

                    F Offline
                    F Offline
                    Fifkie
                    wrote on last edited by
                    #20

                    @StoatPatronus Now as i review the script i posted, i must have just copied that from the tut, not from the script i use because there are several things not matching. But I got Kukkimonsuta's tutorial working for me so i got it working now. For anyone else looking for a solution just follow the steps at https://github.com/Kukkimonsuta/rpi-buildqt . Only thing i had to change was with one of the scripts i got an error that it didn't have the permission to sync one folder from the RPI. So in the sync script i just added

                    --exclude 'vnc'
                    

                    in the rsync under "== Copy /usr/lib =="
                    That's because it wouldn't sync the vnc-folder.

                    S 2 Replies Last reply
                    0
                    • F Fifkie

                      @StoatPatronus Now as i review the script i posted, i must have just copied that from the tut, not from the script i use because there are several things not matching. But I got Kukkimonsuta's tutorial working for me so i got it working now. For anyone else looking for a solution just follow the steps at https://github.com/Kukkimonsuta/rpi-buildqt . Only thing i had to change was with one of the scripts i got an error that it didn't have the permission to sync one folder from the RPI. So in the sync script i just added

                      --exclude 'vnc'
                      

                      in the rsync under "== Copy /usr/lib =="
                      That's because it wouldn't sync the vnc-folder.

                      S Offline
                      S Offline
                      StoatPatronus
                      wrote on last edited by
                      #21

                      @Fifkie I'm glad you got it working. Kukkimonsuta's guide is very helpful. For my project I wrote a couple Ansible playbooks to automate the process, so it's easy to upgrade to new versions of Qt in the future. Unfortunately I can't share them at this point, but I may later if I clean them up.

                      1 Reply Last reply
                      0
                      • F Fifkie

                        @StoatPatronus Now as i review the script i posted, i must have just copied that from the tut, not from the script i use because there are several things not matching. But I got Kukkimonsuta's tutorial working for me so i got it working now. For anyone else looking for a solution just follow the steps at https://github.com/Kukkimonsuta/rpi-buildqt . Only thing i had to change was with one of the scripts i got an error that it didn't have the permission to sync one folder from the RPI. So in the sync script i just added

                        --exclude 'vnc'
                        

                        in the rsync under "== Copy /usr/lib =="
                        That's because it wouldn't sync the vnc-folder.

                        S Offline
                        S Offline
                        StoatPatronus
                        wrote on last edited by
                        #22

                        I cleaned up my ansible playbooks and posted them at https://bitbucket.org/johnwoltman/build_qt_for_pi_with_ansible

                        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