graalvm / graalvm/container

Native-Image cross-compilation from amd64 to arm64 fails on `gcc -v` check

Open
#33 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
190
Forks
39
PR merge metrics
No merged PRs in 30d

Description

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).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the gcc -v toolchain check in ghcr.io/graalvm/native-image:21.3 with --platform=linux/arm64, then compare behavior with JAVA_TOOL_OPTIONS set to the reported launch mechanism. Review the Docker image definitions for graalvm-ce and native-image; done means the intended cross-compilation workflow completes reliably, with the scope of additional gcc target variants decided.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
build-system, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.