Cross-compilation for Librem5

Hey All,

I want to make a hello world app for Librem5 with cross-compilation from Librem14. I read the development documentation and based on it I understand that development is done on the phone itself.

Is there any guide on how to cross-compile GTK app on Librem14 (x86_64) to aarch6?

I get dependancies on binutils and similar for the glib libraries.

Thanks,
D

1 Like

Hi!
I’m just install qemu-aarch64 and create Byzantium/Crimson chroot. It is not “cross-compilation” (when your x86 host compile sources for aarch64 target) but the way to build something for librem5 :slight_smile:

5 Likes

You can do it either way.

Some considerations are:

  • Do you have a lapdock / dock? That’s going to make doing development on the Librem 5 itself a lot more pleasant.
  • How big is the application? If it’s 10,000,000 lines of code, it sure will compile faster on the Librem 14.
  • Is it supposed to be a GUI adaptive application where you really need to test on both the Librem 5 and the Librem 14 (and if you have a lapdock / dock then on the Librem 5 both docked and undocked).
  • Do you have enough free disk space on the Librem 5? If you end up installing large toolchains then it may be easier to use disk space on the Librem 14 and treat the Librem 5 as strictly the target environment.

For Hello World, I would just do it on the Librem 5 - to prove that it can be done!

And the cheat answer … write in Java instead. Then the same binary should work anywhere. Embrace the “Write Once, Run Anywhere” principle. But then cynics have suggested it is really more like “Write Once, Debug Everywhere”.

1 Like

I never thought of doing it like that, you’ve saved me so much time.

2 Likes

I created a docker instance for my rust projects using qemu to compile on librem5

I hope it would help you

2 Likes

Hi @irvinewade,

I have Dell dock station that works perfectly with the Librem5. I get external monitor, keyboard and mouse working with it.
I want to learn how to write a simple app. I don’t have any app ready. I want to learn how to write adaptive GTK app that works both docked and undocked.
My Librem5 has SD card with 64GB capacity. I can get a bigger one if needed.

Haha I will take that Java suggestion but I really want to try rust instead :slight_smile:

Tonight I will start with GNOME Builder on the phone itself using the docking station and then I will try to install Byzantium in chroot with Aarch64 QEMU on my laptop.

2 Likes

Thanks, I will take a look.

1 Like
1 Like