Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to prepare Qt (qmake) cross compiling on amd64 for armhf (Raspberry Pi)

How to prepare Qt (qmake) cross compiling on amd64 for armhf (Raspberry Pi)

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 1.6k 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.
  • S Offline
    S Offline
    SamerAfach
    wrote on last edited by SamerAfach
    #1

    I'm familiar with compiling Qt with no cross-compiling. However, I'd like to create a qmake that can be executed on amd64, but generates code for armhf for Raspberry Pis. This is necessary because our Qt-based software is huge and takes at least 4 hours to compile on a Raspberry Pi, while it takes on a desktop 2 minutes. It's a difficult situation.

    For Ubuntu, there's qt5-qmake-arm-linux-gnueabihf, which is exactly what I'm looking for. I couldn't find that for Debian (Raspbian) Stretch. So my question is: Is there a consistent recipe that can be put into production that can be used to produce a cross-compiling version of Qt from amd64 to armhf?

    Although I found some recipes that claim to do that, but none of them are official, in the sense that they use tricks to work, instead of simply using system tools to create them.

    K Pablo J. RoginaP 2 Replies Last reply
    0
    • S SamerAfach

      I'm familiar with compiling Qt with no cross-compiling. However, I'd like to create a qmake that can be executed on amd64, but generates code for armhf for Raspberry Pis. This is necessary because our Qt-based software is huge and takes at least 4 hours to compile on a Raspberry Pi, while it takes on a desktop 2 minutes. It's a difficult situation.

      For Ubuntu, there's qt5-qmake-arm-linux-gnueabihf, which is exactly what I'm looking for. I couldn't find that for Debian (Raspbian) Stretch. So my question is: Is there a consistent recipe that can be put into production that can be used to produce a cross-compiling version of Qt from amd64 to armhf?

      Although I found some recipes that claim to do that, but none of them are official, in the sense that they use tricks to work, instead of simply using system tools to create them.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @SamerAfach

      Did you see already Qt on Pi and there are some more specifics as well.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      3
      • S SamerAfach

        I'm familiar with compiling Qt with no cross-compiling. However, I'd like to create a qmake that can be executed on amd64, but generates code for armhf for Raspberry Pis. This is necessary because our Qt-based software is huge and takes at least 4 hours to compile on a Raspberry Pi, while it takes on a desktop 2 minutes. It's a difficult situation.

        For Ubuntu, there's qt5-qmake-arm-linux-gnueabihf, which is exactly what I'm looking for. I couldn't find that for Debian (Raspbian) Stretch. So my question is: Is there a consistent recipe that can be put into production that can be used to produce a cross-compiling version of Qt from amd64 to armhf?

        Although I found some recipes that claim to do that, but none of them are official, in the sense that they use tricks to work, instead of simply using system tools to create them.

        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #3

        @SamerAfach in addition to the good links from @koahnig , you may also want to take a look at this cross-compiling guide Qt for Raspberry Pi

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        S 1 Reply Last reply
        1
        • Pablo J. RoginaP Pablo J. Rogina

          @SamerAfach in addition to the good links from @koahnig , you may also want to take a look at this cross-compiling guide Qt for Raspberry Pi

          S Offline
          S Offline
          SamerAfach
          wrote on last edited by
          #4

          @Pablo-J.-Rogina @koahnig Thank you for the links. I was able to finally compile it. I compiled 5.11.2 with the configure command:

          ../${pulldir}/configure -static -no-opengles3 -no-gcc-sysroot -fontconfig -system-freetype -release -debug -no-warnings-are-errors -opengl es2 -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot $ROOTFS -opensource -confirm-license -skip qtwebengine -skip qtscript -nomake examples -nomake tests -qt-xcb -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -extprefix ${currpath}/${installdir}
          

          However, there's a problem that anything I compile there and try to run on the same raspberry pi, from which I got the sysroot, I get the error:

          failed to open vchiq instance
          

          If I compile the same software on raspberry pi, that doesn't happen. Please advise. Am I doing anything wrong?

          Pablo J. RoginaP 1 Reply Last reply
          0
          • S SamerAfach

            @Pablo-J.-Rogina @koahnig Thank you for the links. I was able to finally compile it. I compiled 5.11.2 with the configure command:

            ../${pulldir}/configure -static -no-opengles3 -no-gcc-sysroot -fontconfig -system-freetype -release -debug -no-warnings-are-errors -opengl es2 -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot $ROOTFS -opensource -confirm-license -skip qtwebengine -skip qtscript -nomake examples -nomake tests -qt-xcb -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -extprefix ${currpath}/${installdir}
            

            However, there's a problem that anything I compile there and try to run on the same raspberry pi, from which I got the sysroot, I get the error:

            failed to open vchiq instance
            

            If I compile the same software on raspberry pi, that doesn't happen. Please advise. Am I doing anything wrong?

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @SamerAfach said in How to prepare Qt (qmake) cross compiling on amd64 for armhf (Raspberry Pi):

            failed to open vchiq instance

            Could it be possible that you're using a different user when running the cross-compiled Qt app versus when compiling/running it on the same RPi? If so, this answer may apply to you.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            S 1 Reply Last reply
            0
            • Pablo J. RoginaP Pablo J. Rogina

              @SamerAfach said in How to prepare Qt (qmake) cross compiling on amd64 for armhf (Raspberry Pi):

              failed to open vchiq instance

              Could it be possible that you're using a different user when running the cross-compiled Qt app versus when compiling/running it on the same RPi? If so, this answer may apply to you.

              S Offline
              S Offline
              SamerAfach
              wrote on last edited by SamerAfach
              #6

              @Pablo-J.-Rogina not really. I'm running both with the same user (the only user I have on that rpi).

              Could this be some library problem with egl? I'm trying to play with the libraries to fix this. I wanna mention that I don't have a

              /opt/vc/lib/libEGL.so
              

              On my amd64 machine. Also I never got any compilation errors, btw. That command I ran before from stack exchange for permissions.

              Pablo J. RoginaP 1 Reply Last reply
              0
              • S SamerAfach

                @Pablo-J.-Rogina not really. I'm running both with the same user (the only user I have on that rpi).

                Could this be some library problem with egl? I'm trying to play with the libraries to fix this. I wanna mention that I don't have a

                /opt/vc/lib/libEGL.so
                

                On my amd64 machine. Also I never got any compilation errors, btw. That command I ran before from stack exchange for permissions.

                Pablo J. RoginaP Offline
                Pablo J. RoginaP Offline
                Pablo J. Rogina
                wrote on last edited by
                #7

                @SamerAfach said in How to prepare Qt (qmake) cross compiling on amd64 for armhf (Raspberry Pi):

                I wanna mention that I don't have a
                /opt/vc/lib/libEGL.so

                On my amd64 machine

                No, you shouldn't. However, I guess you SHOULD have $ROOTFS/opt/vc/lib/libEGL.so instead.

                Please look at step 8 from the guide I referred to regarding creating/populating a sysroot in your host PC.

                And please double check the PATH includes /opt/vc/lib when you run the cross-compiled Qt app in your RPi device.

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                S 1 Reply Last reply
                1
                • Pablo J. RoginaP Pablo J. Rogina

                  @SamerAfach said in How to prepare Qt (qmake) cross compiling on amd64 for armhf (Raspberry Pi):

                  I wanna mention that I don't have a
                  /opt/vc/lib/libEGL.so

                  On my amd64 machine

                  No, you shouldn't. However, I guess you SHOULD have $ROOTFS/opt/vc/lib/libEGL.so instead.

                  Please look at step 8 from the guide I referred to regarding creating/populating a sysroot in your host PC.

                  And please double check the PATH includes /opt/vc/lib when you run the cross-compiled Qt app in your RPi device.

                  S Offline
                  S Offline
                  SamerAfach
                  wrote on last edited by SamerAfach
                  #8

                  @Pablo-J.-Rogina I verified that the new configuration is as you mentioned, and did the links correctly to sysroot and that /opt/vc/lib is in the pi where I run the produced executable, but that doesn't help. I did all the steps from the guide also, include relative paths changing. I finally changed the permissions of /dev/vchiq with chmod a+rw /dev/vchiq, and that error didn't appear anymore, but no window would open. The application would look like as if it's running, but no GUI shows up at all. No errors, nothing. I don't even know how to start debugging such a problem.

                  Is there a way to do this without OpenGL completely, with -no-opengl? I don't need OpenGL in my application. Do I absolutely need EGL?

                  Also, please notice that I'm using Qt statically because I don't want our clients to have to get the whole Qt library. I'm guessing that has nothing to do with the problem.

                  One more point is that Raspbian uses Qt 5.7.1 by default. I tried to use that version to do the cross compilation and that doesn't work. Apparently Qt didn't support cross-compilation back then?

                  Please advise on what to do next. I'm not sure how to proceed.

                  EDIT: I tried both Mobaxterm and VNC to see the window showing up. Both didn't.

                  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