Cross compiling - emedded application
-
Hi,
I have a question about the possibility of cross compiling QT applications. I tried to search tutorials on the internet however I still don't understand the last step of cross compilation. To recap, I know the process of creating QT libraries for an embedded system, similarly with toolchain.
However, I am puzzled by the compilation of the main application itself. If I have written a QT application on Linux that works (for example, ubuntu) , I also have a generated .pro for this project from which make is created. I understand how this make works, the application on ubuntu works, however, what if I want to compile the same application for another device (for example rpi), I understand that I need to use the generated qmake (from src's). However, won't the .pro file then need to be changed due to the compilers that will need to be changed? Does it work in such a way that just running qmake under the generated system will make the appropriate compilers appear in make? Should I make any more major changes directly in the .pro or make file after running it from qmake under rpi?
Thanks in advance for your help,
Rafal -
@RafalBilkowski said in Cross compiling - emedded application:
However, won't the .pro file then need to be changed due to the compilers that will need to be changed? Does it work in such a way that just running qmake under the generated system will make the appropriate compilers appear in make?
Yes, exactly. Cross-compiled Qt knows the toolchain (compilers, linkers etc.) that it needs to use. It is very similar to how the same .pro file will work on Linux and Windows - qmake knows which platform to use based on host OS and some flags.
Should I make any more major changes directly in the .pro or make file after running it from qmake under rpi?
No changes needed. BUT! You do not need to run qmake under RPi. The cross-compilation is still done on your host OS - if you cross-compiled on desktop Linux (x86) then this is where you need to run qmake, too.
In other words: your Qt libraries are compiled with your target architecture (arm) but Qt tools (qmake, uic, rcc, moc, etc.) are compiled for your host system (x86).
That's the whole point of cross-compilation: you do it on a strong PC with fast CPU in order to save time. If you tried to compile natively on embedded board, it would take a lot more time.
-
Thanks a lot, I think I understand, but if it would not be a problem I would still ask not to close the thread for a few days. I'd like to test it on a "living organism" in the near future and it's quite possible that I'll have a problem with something else.
Thanks again,