Hello,
I’m trying to get the firefox snap (core22
) cross-compiled from amd64 to aarch64 (and hopefully also armhf).
My first question would be: where can I find docs about the current status of core22
cross-compilation, outside of https://github.com/snapcore/snapcraft/commit/c8e9b2e423cb0702d240814b21224843541c9d2b ? Something like what is working, what would be known as not (yet) working, what is not supported at all …
First, using mozilla-provided sysroot and adjusting paths correct, I could get an arm64
build to finish and run.
on amd64 to arm64
build packages includes only libstdc++-11-dev-arm64-cross
On my road to be able to cross-compile, there were a few bumps, and some might be issues to fix, and some might not:
- is it expected that in this setup, only the x86-64 snap for GNOME SDK is being installed ? For the moment, I’m hacking by manually downloading and extracting it
- as a side effect, the snap contains pkg-config definitions, but they hardcode paths like
/snap/gnome-42-2204-sdk/current/
which is problematic because we still need/snap/gnome-42-2204-sdk/current/
to runamd64
code for the build itself (pkg-config
,gmake
, …). I understand that the revision is a snap-store-level thing, so it might not be known at build time, but we know it at install time (for now, I am relying on a not super nicesed
to update those paths) - when I dont use
--sysroot=
during our build process, I end up onlld
failing to locate/lib/aarch64-linux-gnu/libc.so.6
and I dont see anylibc.so.6
provided by the GNOME SDK snap, I’m wondering if that is on purpose or a bug to only provide the ld scriptusr/lib/aarch64-linux-gnu/libc.so
and nolibc.so
; I believe this could be an actual issue to fix - when I do use
--sysroot=/snap/gnome-42-2204-sdk/xxx
then some libraries are missing, so far I’m blocked onalsa.pc
not being part of the snap (whilelibasound2
is) ; I believe this could be an actual issue to fix - Once I hacked by copying host’s
alsa.pc
the above limitation, I am hitting another one because we dont havelibgcc_s.so.1
in the snap.
Here is the relevant error:
# /root/stage/usr/bin/clang --sysroot /snap/gnome-42-2204-sdk/195 -std=gnu99 --target=aarch64-linux-gnu -o conftest -isystem /root/parts/firefox/install/usr/include -isystem /root/stage/usr/include -isystem /root/parts/firefox/install/usr/include -isystem /root/stage/usr/include -Wl,-rpath-link=/root/parts/firefox/build/obj-aarch64-unknown-linux-gnu/dist/bin -Wl,-rpath-link=/snap/gnome-42-2204-sdk/195/usr/lib/aarch64-linux-gnu -Wl,-rpath-link=/snap/gnome-42-2204-sdk/195/usr/lib -Wl,-rpath-link=/usr/aarch64-linux-gnu/lib/ -fuse-ld=lld -Wl,-rpath-link,/snap/gnome-42-2204-sdk/195/lib/aarch64-linux-gnu -Wl,-rpath-link,/snap/gnome-42-2204-sdk/195/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/usr/aarch64-linux-gnu/lib conftest.c
ld.lld: error: /snap/gnome-42-2204-sdk/195/usr/lib/gcc/aarch64-linux-gnu/11/libgcc_s.so:4: unable to find libgcc_s.so.1
>>> GROUP ( libgcc_s.so.1 -lgcc )
>>> ^
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
snapcraft-firefox-on-amd64-for-arm64-30556937 ../project# cat /snap/gnome-42-2204-sdk/195/usr/lib/gcc/aarch64-linux-gnu/11/libgcc_s.so
/* GNU ld script
Use the shared library, but some functions are only in
the static library. */
GROUP ( libgcc_s.so.1 -lgcc )
Now if I use the cross-arch libstdc++-11-dev-arm64-cross
and remove the --sysroot=
it is picked up from the host:
snapcraft-firefox-on-amd64-for-arm64-30556937 ../project# /root/stage/usr/bin/clang -std=gnu99 --target=aarch64-linux-gnu -o conftest -isystem /root/parts/firefox/install/usr/include -isystem /root/stage/usr/include -isystem /root/parts/firefox/install/usr/include -isystem /root/stage/usr/include -Wl,-rpath-link=/root/parts/firefox/build/obj-aarch64-unknown-linux-gnu/dist/bin -Wl,-rpath-link=/snap/gnome-42-2204-sdk/195/usr/lib/aarch64-linux-gnu -Wl,-rpath-link=/snap/gnome-42-2204-sdk/195/usr/lib -Wl,-rpath-link=/usr/aarch64-linux-gnu/lib/ -fuse-ld=lld -Wl,-rpath-link,/snap/gnome-42-2204-sdk/195/lib/aarch64-linux-gnu -Wl,-rpath-link,/snap/gnome-42-2204-sdk/195/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/usr/aarch64-linux-gnu/lib conftest.c
snapcraft-firefox-on-amd64-for-arm64-30556937 ../project#
There might be other missing libs/pkg-config definitions, but for the moment being I am blocked on the alsa.pc
one.