I want to create native images for both amd64 and arm64, and when I attempt that on my x86 machine (Mac), I start the image ghcr.io/graalvm/native-image:21.3 with --platform=linux/arm64.
Out of the box, this fails during the toolchain-check, as running gcc -v from within the Java process fails.
Adding this resolved the issue for me:
ENV JAVA_TOOL_OPTIONS="-Djdk.lang.Process.launchMechanism=vfork"
Should that be added to the graalvm-ce / native-image Docker images?
Btw, adding gcc variants with different target architectures and the related libs to the Docker image would be awesome - then I could run native-image in my home-architecture while creating native images in the target architecture without having to run the whole thing through qemu (which increases the build time by a factor of 20 for me).