Unsolved Executable library permission?
-
@ChrisW67
If you give the executable file permission, an Exec format error occurs as an error message. -
@IknowQT
If that is really true, then either you are not setting execute permission on an executable file but rather something else, or you have compiled the executable for a different architecture. Also you cannot execute a library.You might want run
file /path/to/the/executable
on the target system to see what it says.I developed and built qt in Ubuntu and completed the distribution file. After copying this distribution file to USB, I installed Raspberry Pi Ubuntu OS on the Raspberry Pi board, and the USB executable file was pasted into Raspberry Pi Ubuntu.
I don't know what "Raspberry Pi Ubuntu OS" is. But there is no guarantee that something compiled under Ubuntu will run on another Ubuntu machine if the architectures are different.
-
I think the architecture is different.
ubuntu architecture is amd64 and ubuntu uploaded to raspberry pi is arm64
Can you build from amd64 to arm64? not compatible?
Or do I have to make a cross-compile? -
@IknowQT said in Executable library permission?:
ubuntu architecture is amd64 and ubuntu uploaded to raspberry pi is arm64
That would indeed explain "Exec format error"! :)
Then you do indeed need to cross-compile on the original Ubuntu for the target ARM architecture. -
Thanks for the reply, I'll talk about it here!
How do I cross-compile? Is it possible in qt creator? -
@IknowQT
I don't know because I have never done it, but, yes, it is certainly possible in Qt Creator. Until somebody answers specifically here, you might start by Googlingqt gcc cross compile arm
, or more specificallycross compile qt for raspberry pi
seems to lead to various hits. -
Wow we're thread-jumping a lot in here :D
Here's something to start with: https://wiki.qt.io/RaspberryPi2EGLFS in your case, large parts of this guide will be different (it's a different OS, different toolchain (take Linaro instead of Raspberry Pi OS toolchain which is super outdated) etc.), libs might be different) but with some tweaking it should work.
-
I'm not using Raspbian OS, I just installed Ubuntu on a Raspberry board. I have two Ubuntus, they are different architectures.
Can you tell me how to cross-compile in this case? -
@IknowQT said in Executable library permission?:
I'm not using Raspbian OS, I just installed Ubuntu on a Raspberry board. I have two Ubuntus, they are different architectures.
I know, that's why I said those instructions won't work exactly as provided.
Can you tell me how to cross-compile in this case?
No, sorry, it's too much effort. I would have to do it all myself, too, to verify the information, and I don't have time for it now.
A high level summary is:
- update your RPi Ubuntu with dev packages (
sudo apt build-dep qt5-default
) - get a toolchain from Linaro, for ARMHF or ARM64 architecture (depending on what your Ubuntu on RPi is using)
- get a sysroot (
rsync
the whole OS from your Raspberry to your desktop) - get Qt (single tarball from archives, for example https://download.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz)
- extract Qt
- run
configure
with correct flags (take ones from the EGLFS guide, but it probably won't work out of the box. Lots of trial and error and frustration will surely follow!) - run
make -j numberOfCpuCores
- run
make install
rsync
your Qt installation back to RPi (you need to copy contents of folder you specified as-extprefix
to folder on RPi you specified in-prefix
)
Now you will have a working, cross-compiled Qt. You can add it to Qt Creator:
- add compiler (Linaro)
- add Qt version (your qmake is in folder you specified as
-hostprefix
) - add kit
With that, you will have a working cross-compilation environment on your desktop Ubuntu. Each compiled binary you will have to send to RPi to run (this can be automated in Qt Creator, too).
Good luck!
- update your RPi Ubuntu with dev packages (
-
you might find it easier to install Qt on your raspi, together with the creator, then just use Remote Desktop session for developing directly on the raspi.