Cross compile targeting Linux ARMv7
-
I have project that involves an embedded device running Ubuntu 16.04.2 LTS. It has a touch screen attached. We need to make a simple app with some basic animations and user interactions. The processor and RAM are both pretty limited and we want to explore Qt as an option for doing this.
I have no Qt experience and I'm not an expert in Linux so I'm having some trouble understanding how to compile an app that will run on ARMv7. There are a lot of tutorials on how target Raspberry Pi but that's not quite the same.
How can I get started on this? I normally develop on Mac but I'm fine using some version of Linux or even Windows if that's easier to do.
Help a newbie out!
-
Hi and welcome to devnet,
Usually, these devices come with a SDK to get started. Do you have that provided ?
Since it's a Linux device, I'd recommend using a virtual machine running a recent Linux distribution. It's going to be easier with the tooling and setting up with regard to the target. Since you are used to macOS, you won't be that lost as it is still a *nix style OS.
-
Okay, thanks for the advice. I'll get ubuntu installed in a VM or in ec2. I'm reasonably familiar with it. I don't think we are provided with any SDK on the device. It's a custom built device, nothing commercial. I'm sure we can add things to it if we need to, but I'm pretty sure we're getting mostly just a baseline version of Linux to start with.
-
Even if custom built, if they are providing you with minimal stuff to build an application for that device, we can start from there.
Qt can be cross-compiled for lots of devices. What you need is the cross-compiler itself (or something generic like the linaro cross-compilers) and the libraries for your target which are usually taken from the target sysroot.
-
Okay, so I was able to get a super basic helloworld app cross compiled from Ubuntu desktop x86 to run on the ARMv7 device. I used
arm-linux-gnueabihf-gcc
for this. Nothing more thanarm-linux-gnueabihf-gcc -o hello hello.c
At this point I'm not sure where to get the sysroot files. Is there any kind of tutorial on this? I think I get the concept of cross compilng and sysroots but I just don't know how to put it all together using Qt.
-
Is it the cross-toolchain from your distribution ?
As for your device, what distribution is it running ?
Or is the system custom built ?For the sysroot, the quick and extreme way is to rsync the content of your device root file system.