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

Unable to use --target option during native-image command #6645

Closed
amrutprabhu opened this issue May 20, 2023 · 3 comments
Closed

Unable to use --target option during native-image command #6645

amrutprabhu opened this issue May 20, 2023 · 3 comments
Assignees
Labels

Comments

@amrutprabhu
Copy link

amrutprabhu commented May 20, 2023

Describe the issue
When I use the --target option to build a target architecture image, the native-image command fails with an output

Error: Unrecognized option: --target

I am currently using a native-maven-plugin from org.graalvm.buildtools to build my image.

My laptop is MacBook pro M2
macos: 13.3.1
graalvm version : GraalVM CE 22.3.0

I installed graalvm jdk using Sdkman.

Now, picked out the command that the plugin ran, and I have reduced the full command and removed the -cp option.

/Users/ap/.sdkman/candidates/java/22.3.r19-grl/bin/native-image \
--no-fallback \
-H:Path=/Users/ap/projects/home-assistant/Home-Assistant/target \
-H:Name=Home-Assistant \
-H:ConfigurationFileDirectories=/Users/ap/projects/home-assistant/Home-Assistant/target/graalvm-reachability-metadata/bae22b6d4f0631f4339c34681a2baf10e3887c14/org.apache.tomcat.embed/tomcat-embed-core/10.0.20,/Users/ap/projects/home-assistant/Home-Assistant/target/graalvm-reachability-metadata/bae22b6d4f0631f4339c34681a2baf10e3887c14/ch.qos.logback/logback-classic/1.4.1 \
--target linux-amd64

Even If I run it independently, it fails. ( without the -cp option) it gives me the same error.

I am trying to build a native image that I can run on an Ubuntu machine.

@fniephaus
Copy link
Member

Hi @amrutprabhu, thanks for reporting the bug. We'll look into it.

I am trying to build a native image that I can run on an Ubuntu machine.

--target will unfortunately not help you with this as Native Image does not support cross-compilation yet. To generate Linux binaries on a macOS machine, please use a containerized environment for now. Or generate binaries for different platforms on CI, for example using GitHub Actions.

@amrutprabhu
Copy link
Author

ok. I was referring to the build options from here: https://docs.oracle.com/en/graalvm/enterprise/22/docs/reference-manual/native-image/overview/BuildOptions/
If you say it's not supported yet I can use the alternative you mentioned.

@vjovanov
Copy link
Member

Note that the correct way to use the option is --target=linux-amd64.

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

No branches or pull requests

3 participants