Setting qmake in QT Creator for cross-compilation raspberry pi
-
Hi everyone.
I want to run cross compilation/debugging for raspberry pi on a host with Ubuntu 22.04. I have compiled QT6.3 from source and tested hello world, it is working properly.
Then I tried cross-debugging my project in vscode, it also works.Now I want to run debugging in QT Creator, but here I can't set a qmake file (in Tools -> Kits -> Qt Version). If I try to set the qmake for ARM, I see the message "Qmake Not Executable".
Can someone tell me how to set qmake in QT Creator for cross-compilation for raspberry pi?
-
Have you compiled Qt natively on Raspberry Pi (you run qmake on RPi itself) or cross-compiled it (you run qmake on Ubuntu)?
-
@sierdzio said in Setting qmake in QT Creator for cross-compilation raspberry pi:
Have you compiled Qt natively on Raspberry Pi (you run qmake on RPi itself) or cross-compiled it (you run qmake on Ubuntu)?
I have cross-compiled QT on Ubuntu. I did it according this instruction: https://github.com/PhysicsX/QTonRaspberryPi#build-qml-qtdeclerative--module
This is screenshot of the error, if I try to add cross-compiled qmake:
-
You may need to add your compilers first but that would be odd. Sorry, I don't know how to fix this, normally Qt Creator has no problems working with cross-compiled Qt.
-
Can you run "/home/vvk/qt-cross/bin/qmake -query" on a terminal? Does that succeed and print something?
What build system are you actually using for your project?@ziller said in Setting qmake in QT Creator for cross-compilation raspberry pi:
Can you run "/home/vvk/qt-cross/bin/qmake -query" on a terminal? Does that succeed and print something?
What build system are you actually using for your project?Result is "Exec format error":
I think it is because qmake is compiled for ARM -
@ziller said in Setting qmake in QT Creator for cross-compilation raspberry pi:
Can you run "/home/vvk/qt-cross/bin/qmake -query" on a terminal? Does that succeed and print something?
What build system are you actually using for your project?Result is "Exec format error":
I think it is because qmake is compiled for ARM@VVKElectro said in Setting qmake in QT Creator for cross-compilation raspberry pi:
I think it is because qmake is compiled for ARM
Then this is NOT cross-compiled Qt but a native build.
-
Since you (supposedly?) have Qt for cross-compiling to raspberry pi, you must have some directory where uic, moc, and other host-tools for building Qt applications are located. There should also be a qmake build for the host at the same location.
From looking over the instructions that you used, I'd guess that that could be "/home/vvk/qt6rpi/bin", but I'm not sure.
-
Hi there,
i am using the same tutorial as input - and guess what am running into the same trouble.
the make is created and also located in the folder as expected - it is simply this error that pops up.
I am totally lost. /home/tian/at6rpt/bin - the make located there I am not able to add this.Does anyone has an hint or a solution on this?
Regards,
Tian -
I am experiencing same issue, I qmake under the qt-cross directory is compiled already for ARM architecture,
file ./qmake
./qmake: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=108cf6bd2a58d3f3e2d3f52d33e3dfbc799fef65, for GNU/Linux 3.7.0, not stripped
It is a pity that the QTCreator tries executing it to collect some data. It will fail for sure. I believe this is QtCreator bug which will break cross-compilation possibility
-
I am experiencing same issue, I qmake under the qt-cross directory is compiled already for ARM architecture,
file ./qmake
./qmake: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=108cf6bd2a58d3f3e2d3f52d33e3dfbc799fef65, for GNU/Linux 3.7.0, not stripped
It is a pity that the QTCreator tries executing it to collect some data. It will fail for sure. I believe this is QtCreator bug which will break cross-compilation possibility
@Eguven said in Setting qmake in QT Creator for cross-compilation raspberry pi:
It is a pity that the QTCreator tries executing it to collect some data. It will fail for sure. I believe this is QtCreator bug which will break cross-compilation possibility
It is not a bug. You are trying to use a native build of Qt for ARM on a x86 machine. It will not work, not in Qt Creator and also not if you try to compile by hand. It's not just
qmake
that has wrong architecture, it is alsomoc
,uic
, and other essential tools.If you want to cross-compile your apps, first cross-compile Qt properly. If you want to build on-device, do then you can use ARM Qt directly on device (including Qt Creator) and it will work - but likely be very slow.