Cross compile with glibc

Is there an easy way to package Arm’s glibc when building my snap on 64 bit AMD + Ubuntu?

I’ve been able to cross compile things that do not use glibc. Here are my build-packages now:
build-packages:
- build-essential
- cmake
- git
- gcc-arm-linux-gnueabihf
- g+±arm-linux-gnueabihf
- libc6-dev-armhf-cross

It looks like it is trying to compile my host glibc, here is the error:
[ 99%] Building C object mysrc/CMakeFiles/mysrc.dir/src/devices.c.o
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,

glib-2.0 is not glibc :wink:

in general YYMV when trying to cross build something with a larger dependency chain …

make sure to have the correct armhf related entries in the sources.list of the host machine and also use the correct architecture for each package you need in build-packages and stage packages.

Is there a way to specify using certain packages depending on the --target-arch switch?

Yes, you can use the snapcraft’s Advanced Grammar as I describe in my answer to another post: Stage-Packages with --target-arch

1 Like