Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
agudian opened this issue Nov 26, 2021 · 2 comments
Open

Comments

@agudian
Copy link

agudian commented Nov 26, 2021

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

@benayat
Copy link

benayat commented Apr 21, 2023

what do you mean by resolved the issue? did it really run flawlessly with just changing that? what about jni, reflection, etc...
using qemu with kvm could make it much faster. but still, the best and cheap option for me was using a T2A instance in gcloud for the arm compilation.

@justpolidor
Copy link

ENV JAVA_TOOL_OPTIONS="-Djdk.lang.Process.launchMechanism=vfork"

This doesn't solve the issue. I am creating a native image on my Mac M2 with the flag --platform=linux/amd64 and I get

[1/7] Initializing... (0.0s @ 0.31GB) Error: Collecting native-compiler info with '/usr/local/musl/bin/x86_64-linux-musl-gcc -v' failed Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain com.oracle.svm.core.util.UserError$UserException: Collecting native-compiler info with '/usr/local/musl/bin/x86_64-linux-musl-gcc -v' failed To prevent native-toolchain checking provide command-line option -H:-CheckToolchain

I am running the command inside a container from of image ghcr.io/graalvm/native-image:muslib-ol9-java17-22.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants