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-compiled for Raspberry.. how to compile directly on Rpi now ?
Forum Updated to NodeBB v4.3 + New Features

Cross-compiled for Raspberry.. how to compile directly on Rpi now ?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 4 Posters 1.3k Views 2 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.
  • R Offline
    R Offline
    rokk
    wrote on last edited by
    #1

    Hi,
    I cross-compiled Qt5.15.2 for RPi4 and everything is fine, I thought that also tools like qmake would have been cross-compiled, while they are not, I understand that they are host-tools and thus supposed to be run on the host. My question is (I already know how to cross-compile my applications using qmake on the host).. since I now have Qt5.15.2 on the RPi, how could I compile an application directly on the RPi ? I cannot use use deployed qmake since it's for another architecture (the host one).. Can I install qmake and configure it to use Qt5.15.2? Thanks

    sierdzioS KroMignonK 2 Replies Last reply
    0
    • R rokk

      Hi,
      I cross-compiled Qt5.15.2 for RPi4 and everything is fine, I thought that also tools like qmake would have been cross-compiled, while they are not, I understand that they are host-tools and thus supposed to be run on the host. My question is (I already know how to cross-compile my applications using qmake on the host).. since I now have Qt5.15.2 on the RPi, how could I compile an application directly on the RPi ? I cannot use use deployed qmake since it's for another architecture (the host one).. Can I install qmake and configure it to use Qt5.15.2? Thanks

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

      Can I install qmake and configure it to use Qt5.15.2? Thanks

      No, I'm fairly sure it won't work.

      If you want Qt 5.15, you need to compile it on the actual device yourself. It actually works, most of the time (sometimes small patching is needed), but remember to limit number of modules as much as you can (compiling whole Qt on RPi will take many hours).

      Perhaps you can natively compile just qmake and then use it with your cross-compiled Qt. That's definitely easy to test, although I don't expect it to work.

      (Z(:^

      R 1 Reply Last reply
      0
      • R rokk

        Hi,
        I cross-compiled Qt5.15.2 for RPi4 and everything is fine, I thought that also tools like qmake would have been cross-compiled, while they are not, I understand that they are host-tools and thus supposed to be run on the host. My question is (I already know how to cross-compile my applications using qmake on the host).. since I now have Qt5.15.2 on the RPi, how could I compile an application directly on the RPi ? I cannot use use deployed qmake since it's for another architecture (the host one).. Can I install qmake and configure it to use Qt5.15.2? Thanks

        KroMignonK Offline
        KroMignonK Offline
        KroMignon
        wrote on last edited by
        #3

        @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

        since I now have Qt5.15.2 on the RPi, how could I compile an application directly on the RPi ?

        You have to choose what you want to do:

        • cross-compiling: creating executable code for a platform other than the one on which the compiler is running.
        • native compiling: creating executable code on platform on which it will run.

        If you want to build your code on RPi, you have to build a Qt-Kit on RPi.
        I would recommend you to do cross-compiling, as you PC will be much more powerful than the RPi!

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        R 1 Reply Last reply
        0
        • KroMignonK KroMignon

          @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

          since I now have Qt5.15.2 on the RPi, how could I compile an application directly on the RPi ?

          You have to choose what you want to do:

          • cross-compiling: creating executable code for a platform other than the one on which the compiler is running.
          • native compiling: creating executable code on platform on which it will run.

          If you want to build your code on RPi, you have to build a Qt-Kit on RPi.
          I would recommend you to do cross-compiling, as you PC will be much more powerful than the RPi!

          R Offline
          R Offline
          rokk
          wrote on last edited by
          #4

          Thanks @KroMignon

          My idea was just to enable both possibilities. Since I already built (cross-compiling) Qt5.15.2 for ARM architecture I was wondering about the possibility to use it both in my PC to cross-compile my application but also on RPi for native compiliing (so I don't need a host PC for that, since my application doesn't require long time to build).
          I was natively compiling on the RPi with Qt5.11 which is shipped in Raspbian Buster just installing some packages (never built it from source) and was pretty straigthforward, but now I had to move to Qt5.15 and was wandering what was the convenient way for compiling since there is no possibility to update Qt from the repositories in Buster.
          I understand that I have 2 options now.. cross-compiling (maybe I could create a docker or VM for that) or build Qt from source in the RPi although this will require several hours..

          1 Reply Last reply
          0
          • sierdzioS sierdzio

            @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

            Can I install qmake and configure it to use Qt5.15.2? Thanks

            No, I'm fairly sure it won't work.

            If you want Qt 5.15, you need to compile it on the actual device yourself. It actually works, most of the time (sometimes small patching is needed), but remember to limit number of modules as much as you can (compiling whole Qt on RPi will take many hours).

            Perhaps you can natively compile just qmake and then use it with your cross-compiled Qt. That's definitely easy to test, although I don't expect it to work.

            R Offline
            R Offline
            rokk
            wrote on last edited by
            #5

            Thanks @sierdzio
            Natively compile qmake and use it with the cross-compiled Qt would allow me to have 2 possibility, without re-building Qt on the RPi (can be a pain, I know).. I understand now that qmake is much more complicated than it seems and probably linked with many other components in the Qt Kit..that's why you think it won't work, isn't it ?

            KroMignonK 1 Reply Last reply
            0
            • R rokk

              Thanks @sierdzio
              Natively compile qmake and use it with the cross-compiled Qt would allow me to have 2 possibility, without re-building Qt on the RPi (can be a pain, I know).. I understand now that qmake is much more complicated than it seems and probably linked with many other components in the Qt Kit..that's why you think it won't work, isn't it ?

              KroMignonK Offline
              KroMignonK Offline
              KroMignon
              wrote on last edited by
              #6

              @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

              I understand now that qmake is much more complicated than it seems and probably linked with many other components in the Qt Kit

              qmake will generate the Makefile base on content of your project file => cf. https://doc.qt.io/qt-5/qmake-manual.html

              that's why you think it won't work, isn't it ?

              No, it would not work because qmake have been build to run on the PC not on RPi!

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              R 1 Reply Last reply
              0
              • KroMignonK KroMignon

                @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                I understand now that qmake is much more complicated than it seems and probably linked with many other components in the Qt Kit

                qmake will generate the Makefile base on content of your project file => cf. https://doc.qt.io/qt-5/qmake-manual.html

                that's why you think it won't work, isn't it ?

                No, it would not work because qmake have been build to run on the PC not on RPi!

                R Offline
                R Offline
                rokk
                wrote on last edited by
                #7

                @KroMignon said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                No, it would not work because qmake have been build to run on the PC not on RPi!

                I mean building qmake from source on RPi and configuring it (I still don't know how) to use the already cross-compiled Qt5.15.2 ..

                KroMignonK 1 Reply Last reply
                0
                • R rokk

                  @KroMignon said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                  No, it would not work because qmake have been build to run on the PC not on RPi!

                  I mean building qmake from source on RPi and configuring it (I still don't know how) to use the already cross-compiled Qt5.15.2 ..

                  KroMignonK Offline
                  KroMignonK Offline
                  KroMignon
                  wrote on last edited by
                  #8

                  @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                  I mean building qmake from source on RPi and configuring it (I still don't know how) to use the already cross-compiled Qt5.15.2 ..

                  And how should this be possible?
                  Please understand that cross-compiling Qt means that you build the libraries for the target device (the RPi) but all build tools like qmake, moc, etc are build to run on the compiler machine, not on RPi.

                  If you want to build your Qt projects directly on RPi, than the easiest way is to use the Qt binaries available with Raspbian (I guess you are using Raspian on your RPi).

                  It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                  R 1 Reply Last reply
                  0
                  • KroMignonK KroMignon

                    @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                    I mean building qmake from source on RPi and configuring it (I still don't know how) to use the already cross-compiled Qt5.15.2 ..

                    And how should this be possible?
                    Please understand that cross-compiling Qt means that you build the libraries for the target device (the RPi) but all build tools like qmake, moc, etc are build to run on the compiler machine, not on RPi.

                    If you want to build your Qt projects directly on RPi, than the easiest way is to use the Qt binaries available with Raspbian (I guess you are using Raspian on your RPi).

                    R Offline
                    R Offline
                    rokk
                    wrote on last edited by
                    #9

                    Thanks for answering @KroMignon but sorry I think there is a misunderstaning.. I try to better clarify. What I'd like to do is:

                    I have my RPi where I cross-compiled Qt5.15.2, so there is a folder /usr/local/Qt5.15.2 (cross-compiled on my host PC and transferred on the RPi). In this folder there is qmake, but it is X86_64 architecture, since has been built to run on the host PC so I cannot use it in the RPi (that's totally expected).
                    Now.. forget about my host PC, what if I download again the Qt sources on the RPi and build there only qmake..? at this point this qmake will be ARM architecture and can be run on the RPi.
                    What is left is to configure (IDK how) this qmake to use Qt in /usr/local/Qt5.15.2 .. Is there any way ? Is that feasible?

                    KroMignonK Pablo J. RoginaP 2 Replies Last reply
                    0
                    • R rokk

                      Thanks for answering @KroMignon but sorry I think there is a misunderstaning.. I try to better clarify. What I'd like to do is:

                      I have my RPi where I cross-compiled Qt5.15.2, so there is a folder /usr/local/Qt5.15.2 (cross-compiled on my host PC and transferred on the RPi). In this folder there is qmake, but it is X86_64 architecture, since has been built to run on the host PC so I cannot use it in the RPi (that's totally expected).
                      Now.. forget about my host PC, what if I download again the Qt sources on the RPi and build there only qmake..? at this point this qmake will be ARM architecture and can be run on the RPi.
                      What is left is to configure (IDK how) this qmake to use Qt in /usr/local/Qt5.15.2 .. Is there any way ? Is that feasible?

                      KroMignonK Offline
                      KroMignonK Offline
                      KroMignon
                      wrote on last edited by
                      #10

                      @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                      What is left is to configure (IDK how) this qmake to use Qt in /usr/local/Qt5.15.2 .. Is there any way ? Is that feasible?

                      I don't know how to do it and think it is not possible.
                      I am not aware about any configure settings to build only binaries without libraries.

                      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                      sierdzioS 1 Reply Last reply
                      0
                      • R rokk

                        Thanks for answering @KroMignon but sorry I think there is a misunderstaning.. I try to better clarify. What I'd like to do is:

                        I have my RPi where I cross-compiled Qt5.15.2, so there is a folder /usr/local/Qt5.15.2 (cross-compiled on my host PC and transferred on the RPi). In this folder there is qmake, but it is X86_64 architecture, since has been built to run on the host PC so I cannot use it in the RPi (that's totally expected).
                        Now.. forget about my host PC, what if I download again the Qt sources on the RPi and build there only qmake..? at this point this qmake will be ARM architecture and can be run on the RPi.
                        What is left is to configure (IDK how) this qmake to use Qt in /usr/local/Qt5.15.2 .. Is there any way ? Is that feasible?

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

                        @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                        I have my RPi where I cross-compiled Qt5.15.2, so there is a folder /usr/local/Qt5.15.2 (cross-compiled on my host PC and transferred on the RPi)

                        What if you use cmake in RPi to manage your Qt projects?

                        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

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

                          @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                          I have my RPi where I cross-compiled Qt5.15.2, so there is a folder /usr/local/Qt5.15.2 (cross-compiled on my host PC and transferred on the RPi)

                          What if you use cmake in RPi to manage your Qt projects?

                          KroMignonK Offline
                          KroMignonK Offline
                          KroMignon
                          wrote on last edited by
                          #12

                          @Pablo-J-Rogina said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                          What if you use cmake in RPi to manage your Qt projects?

                          AFAIK, cmake version for Qt has specific/custom extensions/patches. I don't know if "out of the box" cmake will be usable.
                          But I don't have any experience with cmake, so my comment may be wrong.

                          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                          1 Reply Last reply
                          0
                          • KroMignonK KroMignon

                            @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                            What is left is to configure (IDK how) this qmake to use Qt in /usr/local/Qt5.15.2 .. Is there any way ? Is that feasible?

                            I don't know how to do it and think it is not possible.
                            I am not aware about any configure settings to build only binaries without libraries.

                            sierdzioS Offline
                            sierdzioS Offline
                            sierdzio
                            Moderators
                            wrote on last edited by
                            #13

                            @KroMignon said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                            @rokk said in Cross-compiled for Raspberry.. how to compile directly on Rpi now ?:

                            What is left is to configure (IDK how) this qmake to use Qt in /usr/local/Qt5.15.2 .. Is there any way ? Is that feasible?

                            I don't know how to do it and think it is not possible.
                            I am not aware about any configure settings to build only binaries without libraries.

                            qmake is built when you run configure. Remaining tools (moc and the like) can probably be compiled if configure was run with -nomake libs, but I'm not sure. In any case it should be enough to compile just qtbase to test this approach - @rokk when you copy or download Qt source code to your RPi, remove directories other than qtbase, then compile Qt normally. Compiling just qtbase will probably take ~30 minutes on a RPi.

                            (Z(:^

                            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