Cross-compiled for Raspberry.. how to compile directly on Rpi now ?
-
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 -
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@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
qmakeand then use it with your cross-compiled Qt. That's definitely easy to test, although I don't expect it to work. -
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@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! -
@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!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.. -
@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
qmakeand then use it with your cross-compiled Qt. That's definitely easy to test, although I don't expect it to work.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 ? -
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 ?@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
qmakewill generate theMakefilebase on content of your project file => cf. https://doc.qt.io/qt-5/qmake-manual.htmlthat's why you think it won't work, isn't it ?
No, it would not work because
qmakehave been build to run on the PC not on RPi! -
@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
qmakewill generate theMakefilebase on content of your project file => cf. https://doc.qt.io/qt-5/qmake-manual.htmlthat's why you think it won't work, isn't it ?
No, it would not work because
qmakehave been build to run on the PC not on RPi!@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 ..
-
@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 ..
@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 likeqmake,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).
-
@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 likeqmake,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).
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? -
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?@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. -
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?@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?
-
@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?
@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. -
@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.@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.qmakeis built when you runconfigure. Remaining tools (mocand 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 justqtbaseto test this approach - @rokk when you copy or download Qt source code to your RPi, remove directories other thanqtbase, then compile Qt normally. Compiling justqtbasewill probably take ~30 minutes on a RPi.