Arkaik
Arkaik

Reputation: 902

Cross-compile Qt for specific arm target from 64bits Linux

I'm currently trying to compile a project and port it to a 32bit target deploying a Linux based system.

My host machine runs x86_64 Debian Stretch and my target is an Atmel SAMA5d2 running a custom Linux. My cross toolchain is generated from buildroot.

At the moment I'm able to cross compile applications for the target using the buildroot generated toolchain. However, I would like to integrate Qt and build Qt apps for the target.

To be able to build my applications for the targetted platform I need to compile Qt for my target. To do so I have to tell Qt to use the buildroot toolchain instead of the native one.

From what I found I either have to provide -device <device> --device-option CROSS_COMPILE=$TOOLCHAIN_PATH or -xplatform <mkspec> to configure Qt with the expected toolchain.

Obviously my target is not in the device list under qtbase/mkspecs/devices so I think the best solution is to create a mkspec for my target.

My command should look like this :

./configure -xplatform <my_mkspec> -embedded arm -prefix <customQtPath>

However I'm kinda lost and I don't know how to do it only from documentation and what I found by googling my problem.
Also do I need to specify the target is 32bit as armv7 is only 32bits?

I would be glad to have some help on this. Thanks.

Upvotes: 1

Views: 1367

Answers (1)

Luca Carlon
Luca Carlon

Reputation: 9986

Your assumptions are correct. You can read similar specs and create your own, those are pretty simple. For instance Pi2 is an armv7 device, you can start from this qmake.conf. Then, pass to configure:

-device <given_name> -device-option CROSS_COMPILE=<path_and_prefix> -sysroot <your_sysroot>

just change paths, tune cflags if needed etc... Then follow build tutorials.

Upvotes: 1

Related Questions