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

Build static native image for linux amd64 system #727

Closed
gzm55 opened this issue Oct 26, 2022 · 5 comments
Closed

Build static native image for linux amd64 system #727

gzm55 opened this issue Oct 26, 2022 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@gzm55
Copy link
Contributor

gzm55 commented Oct 26, 2022

Static native image improves the portability between different libc types (glibc or musl) and glibc versions on x64 linux.

@gnodet
Copy link
Contributor

gnodet commented Oct 26, 2022

Sounds good.
This will need to be integrated into https://github.com/apache/maven-mvnd/blob/master/.github/workflows/release.yaml
Not sure about the cost of building musl during the GitHub release workflow though...

@gzm55
Copy link
Contributor Author

gzm55 commented Oct 27, 2022

from graalvm ga example, it is already integrated with option native-image-musl

@ppalaga
Copy link
Contributor

ppalaga commented Oct 27, 2022

Indeed, this would be nice!

@gzm55 do you happen to know how much bigger will the native executable become?

@gzm55
Copy link
Contributor Author

gzm55 commented Oct 27, 2022

Indeed, this would be nice!

@gzm55 do you happen to know how much bigger will the native executable become?

not yet, i will try it at weekend

@gzm55
Copy link
Contributor Author

gzm55 commented Oct 29, 2022

the preparation of the tool chains takes less than 1 minutes, and the increasement of the image sizes can be ignored, less than 1%.

The problem is that the embedded JNIs still depends on glibc:

$ maven-mvnd-0.9.0-SNAPSHOT-linux-amd64/bin/mvnd --status
Failed to load native library:jansi-2.4.0-df4a30a9a564804a-libjansi.so. osinfo: Linux/x86_64
java.lang.UnsatisfiedLinkError: Can't load library: /tmp/jansi-2.4.0-df4a30a9a564804a-libjansi.so
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.fusesource.jansi.internal.CLibrary.isatty(I)I [symbol: Java_org_fusesource_jansi_internal_CLibrary_isatty or Java_org_fusesource_jansi_internal_CLibrary_isatty__I]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:152)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:53)
        at org.fusesource.jansi.internal.CLibrary.isatty(CLibrary.java)
        at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:95)

The related issue is oracle/graal#4028

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

No branches or pull requests

3 participants