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. How do I setup a kit to crosscompile for Raspbian for the Pi3?
QtWS25 Last Chance

How do I setup a kit to crosscompile for Raspbian for the Pi3?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
27 Posts 7 Posters 5.2k 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.
  • G Offline
    G Offline
    graniteDev
    wrote on last edited by
    #1

    I'm used to using Qt for the desktop, but for the life of me I can't find any instructions for setting up my Linux box Qt5.11 to compile for Raspbian. All the instructions I've come across want to force the pi to boot to Qt. I don't want to do that. I just want to make an app and run it on the pi. How do I do this?

    1 Reply Last reply
    0
    • sneubertS Offline
      sneubertS Offline
      sneubert
      wrote on last edited by
      #2

      a litte bit outdated but you´ll get the idea

      https://wiki.qt.io/RaspberryPi2EGLFS

      G 2 Replies Last reply
      3
      • mranger90M Offline
        mranger90M Offline
        mranger90
        wrote on last edited by
        #3

        https://www.ics.com/tag/raspberry-pi

        1 Reply Last reply
        1
        • sneubertS sneubert

          a litte bit outdated but you´ll get the idea

          https://wiki.qt.io/RaspberryPi2EGLFS

          G Offline
          G Offline
          graniteDev
          wrote on last edited by
          #4

          @sneubert The very first sentence explains that this is to do exactly what I DON'T want to do. I DON'T want to make an embedded full screen app. I WANT to make a widget app for the Pi.

          1 Reply Last reply
          0
          • sneubertS sneubert

            a litte bit outdated but you´ll get the idea

            https://wiki.qt.io/RaspberryPi2EGLFS

            G Offline
            G Offline
            graniteDev
            wrote on last edited by
            #5

            @sneubert It would be doubly awesome if I could cross compile the thing to save development time.

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

              Hi,

              Then use the xcb backend on the Pi like it's used on the desktop.

              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
              2
              • sneubertS Offline
                sneubertS Offline
                sneubert
                wrote on last edited by
                #7

                @graniteDev

                to add to SGaist, the mentionted guide is not using Qt for Device Creation (boot to Qt).
                Your are right the guide states it´s not intended for running desktop-style, windowed Qt apps under X11 but as it´s an howto on setting up a crosscompiler for raspbian your are free to choose the platform plugin used to display your app. For XCB see http://doc.qt.io/qt-5/embedded-linux.html#xcb
                Maybe you have to add some additional libs to be able to compile xcb (http://doc.qt.io/qt-5/linux-requirements.html).
                But once again, even if you use the eglfs plugin it´s not using boot to Qt! You are only not using a window manager. BTW this is independent from the decision using widgets or quick, if you use vc4 on the rpi

                G 1 Reply Last reply
                2
                • sneubertS sneubert

                  @graniteDev

                  to add to SGaist, the mentionted guide is not using Qt for Device Creation (boot to Qt).
                  Your are right the guide states it´s not intended for running desktop-style, windowed Qt apps under X11 but as it´s an howto on setting up a crosscompiler for raspbian your are free to choose the platform plugin used to display your app. For XCB see http://doc.qt.io/qt-5/embedded-linux.html#xcb
                  Maybe you have to add some additional libs to be able to compile xcb (http://doc.qt.io/qt-5/linux-requirements.html).
                  But once again, even if you use the eglfs plugin it´s not using boot to Qt! You are only not using a window manager. BTW this is independent from the decision using widgets or quick, if you use vc4 on the rpi

                  G Offline
                  G Offline
                  graniteDev
                  wrote on last edited by
                  #8

                  @sneubert
                  Alright, I'll have to try to figure this out. I'm not familiar enough with Qts inner workings as on the desktop, you download Qt Creator, chose your version of Qt, and then your set.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    graniteDev
                    wrote on last edited by
                    #9

                    I've not been able to get passed this part of the instructions from this link https://wiki.qt.io/RaspberryPi2EGLFS

                    git clone git://code.qt.io/qt/qtbase.git -b <qt-version>
                    cd qtbase
                    ./configure -release -opengl es2 -device <rpi-version> -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v
                    

                    And I modified it to be as so to fit my configuration and run it inside the raspi/qtbase/ directory

                    ./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/home/brandon/development/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot /home/brandon/development/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/brandon/development/raspi/qt5pi -hostprefix /home/brandon/development/raspi/qt5 -v
                    

                    It runs for a while, lots of text flying passed the screen, and then it stops, and says it this:

                    Project ERROR: Cannot run target compiler '/home/brandon/development/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++'. Output:
                    ===================
                    sh: 1: /home/brandon/development/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++: not found
                    ===================
                    Maybe you forgot to setup the environment?
                    
                    

                    I don't have the compiler, but I don't know why it's missing. I have not had any issues with the instructions up to this point - but since I'm completely baffled by what exactly the instructions are having me do, I don't know how fix this.

                    For the record, it's completely maddening how difficult it is to get setup to build for the pi. I don't understand why this is so difficult when Qt makes so easy on everything else.

                    aha_1980A 1 Reply Last reply
                    0
                    • G graniteDev

                      I've not been able to get passed this part of the instructions from this link https://wiki.qt.io/RaspberryPi2EGLFS

                      git clone git://code.qt.io/qt/qtbase.git -b <qt-version>
                      cd qtbase
                      ./configure -release -opengl es2 -device <rpi-version> -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v
                      

                      And I modified it to be as so to fit my configuration and run it inside the raspi/qtbase/ directory

                      ./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/home/brandon/development/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot /home/brandon/development/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/brandon/development/raspi/qt5pi -hostprefix /home/brandon/development/raspi/qt5 -v
                      

                      It runs for a while, lots of text flying passed the screen, and then it stops, and says it this:

                      Project ERROR: Cannot run target compiler '/home/brandon/development/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++'. Output:
                      ===================
                      sh: 1: /home/brandon/development/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++: not found
                      ===================
                      Maybe you forgot to setup the environment?
                      
                      

                      I don't have the compiler, but I don't know why it's missing. I have not had any issues with the instructions up to this point - but since I'm completely baffled by what exactly the instructions are having me do, I don't know how fix this.

                      For the record, it's completely maddening how difficult it is to get setup to build for the pi. I don't understand why this is so difficult when Qt makes so easy on everything else.

                      aha_1980A Offline
                      aha_1980A Offline
                      aha_1980
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @graniteDev said in How do I setup a kit to crosscompile for Raspbian for the Pi3?:

                      I don't have the compiler, but I don't know why it's missing.

                      Huh? Either you have it, or not. In your configure line, you told configure to use the toolchain CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-.

                      Did you mean .../usr/bin/arm-linux-gnueabihf- ?

                      Or where is your cross-toolchain installed?

                      Qt has to stay free or it will die.

                      G 1 Reply Last reply
                      0
                      • aha_1980A aha_1980

                        @graniteDev said in How do I setup a kit to crosscompile for Raspbian for the Pi3?:

                        I don't have the compiler, but I don't know why it's missing.

                        Huh? Either you have it, or not. In your configure line, you told configure to use the toolchain CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-.

                        Did you mean .../usr/bin/arm-linux-gnueabihf- ?

                        Or where is your cross-toolchain installed?

                        G Offline
                        G Offline
                        graniteDev
                        wrote on last edited by
                        #11
                        This post is deleted!
                        aha_1980A 1 Reply Last reply
                        0
                        • G graniteDev

                          This post is deleted!

                          aha_1980A Offline
                          aha_1980A Offline
                          aha_1980
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @graniteDev

                          You still didn't answer my question:

                          Or where is your cross-toolchain installed?

                          In other words, where is arm-linux-gnueabihf-g++ located?

                          So I honestly don't know if that's right or wrong because i'm not at all familiar with this process.

                          If you like it or not, cross-compiling is an advanced topic which requires deep understanding of the involved tools.

                          You should probably start cross-compiling a "hello world" application before trying a large library like Qt.

                          Qt has to stay free or it will die.

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            graniteDev
                            wrote on last edited by
                            #13

                            So i search for the compiler after digging into the details and the error appears to be in error. That entire path that it says doesn't exist, does exist.

                            /home/brandon/development/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++

                            I can cd into that last bin directory and there are about 2 dozen compilers in there and arm-linux-gnueabihf-g++ is in there. for some reason it appends g++ to the string which is why the instructions have you only put " arm-linux-gnueabihf-"

                            So now I understand better what it wants, but not why it can't find it.

                            aha_1980A 1 Reply Last reply
                            0
                            • G graniteDev

                              So i search for the compiler after digging into the details and the error appears to be in error. That entire path that it says doesn't exist, does exist.

                              /home/brandon/development/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++

                              I can cd into that last bin directory and there are about 2 dozen compilers in there and arm-linux-gnueabihf-g++ is in there. for some reason it appends g++ to the string which is why the instructions have you only put " arm-linux-gnueabihf-"

                              So now I understand better what it wants, but not why it can't find it.

                              aha_1980A Offline
                              aha_1980A Offline
                              aha_1980
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @graniteDev

                              Ok, so the paths are 100% the same? Does the compiler arm-linux-gnueabihf-g++ have the executable bit set? Sometimes you also have to call an "enviroment-setup" script to use the cross toolchain, not sure if that applies to your toolchain also.

                              Btw: arm-linux-gnueabihf- is the cross-toolchain-prefix, which tells you that the compiler produces "arm" executables for linux. "hf" stands for hardware floating point support and "gnueabi", I honestly would have to google it ;) g++ is just the GNU GCC C++ compiler. Your normal compiler is therefore called g++, and the cross-compiler is called arm-linux-gnueabihf-g++.

                              Qt has to stay free or it will die.

                              G 1 Reply Last reply
                              1
                              • aha_1980A aha_1980

                                @graniteDev

                                Ok, so the paths are 100% the same? Does the compiler arm-linux-gnueabihf-g++ have the executable bit set? Sometimes you also have to call an "enviroment-setup" script to use the cross toolchain, not sure if that applies to your toolchain also.

                                Btw: arm-linux-gnueabihf- is the cross-toolchain-prefix, which tells you that the compiler produces "arm" executables for linux. "hf" stands for hardware floating point support and "gnueabi", I honestly would have to google it ;) g++ is just the GNU GCC C++ compiler. Your normal compiler is therefore called g++, and the cross-compiler is called arm-linux-gnueabihf-g++.

                                G Offline
                                G Offline
                                graniteDev
                                wrote on last edited by
                                #15

                                @aha_1980

                                Double checked, yes it has the execution bit set for own, group and everyone else. I've added that bin to the path for good measure.

                                Here is something odd. If I cd into that bin directory and

                                ./arm-linux-gnueabihf-g++
                                

                                the result

                                bash: ./arm-linux-gnueabihf-g++: No such file or directory
                                

                                What seriously is wrong? The file is right in that directory! It even autocompletes for me! I really don't get this.

                                aha_1980A 1 Reply Last reply
                                0
                                • G graniteDev

                                  @aha_1980

                                  Double checked, yes it has the execution bit set for own, group and everyone else. I've added that bin to the path for good measure.

                                  Here is something odd. If I cd into that bin directory and

                                  ./arm-linux-gnueabihf-g++
                                  

                                  the result

                                  bash: ./arm-linux-gnueabihf-g++: No such file or directory
                                  

                                  What seriously is wrong? The file is right in that directory! It even autocompletes for me! I really don't get this.

                                  aha_1980A Offline
                                  aha_1980A Offline
                                  aha_1980
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  @graniteDev

                                  Puh, that's getting a tough one. But I don't give up yet. Can you please do a file ./arm-linux-gnueabihf-g++ in that directory and post the output here?

                                  Qt has to stay free or it will die.

                                  G 1 Reply Last reply
                                  0
                                  • aha_1980A aha_1980

                                    @graniteDev

                                    Puh, that's getting a tough one. But I don't give up yet. Can you please do a file ./arm-linux-gnueabihf-g++ in that directory and post the output here?

                                    G Offline
                                    G Offline
                                    graniteDev
                                    wrote on last edited by
                                    #17

                                    @aha_1980

                                    No problem:

                                    ./arm-linux-gnueabihf-g++: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, stripped
                                    

                                    ok....is it a problem that that says intel and I'm running amd?

                                    aha_1980A 1 Reply Last reply
                                    0
                                    • G graniteDev

                                      @aha_1980

                                      No problem:

                                      ./arm-linux-gnueabihf-g++: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, stripped
                                      

                                      ok....is it a problem that that says intel and I'm running amd?

                                      aha_1980A Offline
                                      aha_1980A Offline
                                      aha_1980
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      @graniteDev

                                      Ok, I think you your problem is, that this toolchain is for 32-Bit PC (i.e. x86), while you are probably running a 64 bit system (i.e. x86_64, you can check with the arch command).

                                      It might be possible to get this to run, but I'd rather recommend you to get a toolchain that directly runs on your system. you avoid the memory limits of 32 bit architecture with that also.

                                      So far...

                                      Qt has to stay free or it will die.

                                      G 2 Replies Last reply
                                      0
                                      • aha_1980A aha_1980

                                        @graniteDev

                                        Ok, I think you your problem is, that this toolchain is for 32-Bit PC (i.e. x86), while you are probably running a 64 bit system (i.e. x86_64, you can check with the arch command).

                                        It might be possible to get this to run, but I'd rather recommend you to get a toolchain that directly runs on your system. you avoid the memory limits of 32 bit architecture with that also.

                                        So far...

                                        G Offline
                                        G Offline
                                        graniteDev
                                        wrote on last edited by
                                        #19

                                        @aha_1980 Hmm...ok, maybe I missunderstood some of the instruction when it talked about 64bit. I assumed it was talking about the pi, which is 32bit, but yeah it's a brand new Ryzen machine, it's 64 bit.

                                        I'll have to come back to this later today, but thank you for that. I'll let you know what I find.

                                        1 Reply Last reply
                                        1
                                        • aha_1980A aha_1980

                                          @graniteDev

                                          Ok, I think you your problem is, that this toolchain is for 32-Bit PC (i.e. x86), while you are probably running a 64 bit system (i.e. x86_64, you can check with the arch command).

                                          It might be possible to get this to run, but I'd rather recommend you to get a toolchain that directly runs on your system. you avoid the memory limits of 32 bit architecture with that also.

                                          So far...

                                          G Offline
                                          G Offline
                                          graniteDev
                                          wrote on last edited by graniteDev
                                          #20

                                          @aha_1980

                                          arch command on my desktop:
                                          x86_64

                                          the pi:
                                          armv7l

                                          aha_1980A Pablo J. RoginaP 2 Replies 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