Open rsenden opened 1 year ago
+1. We are also facing this issue.
A PR would be welcomed @rsenden
Let me give it a try, I'm doing some work on this.
Thanks for looking into this!
On Thu, Sep 28, 2023, 19:58 Glavo @.***> wrote:
Let me give it a try, I'm doing some work on this.
— Reply to this email directly, view it on GitHub https://github.com/fusesource/jansi/issues/246#issuecomment-1739777950, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB4GAQBMK4QAN5UWKDWZXTX4W3EHANCNFSM6AAAAAATDB4VSU . You are receiving this because you were mentioned.Message ID: @.***>
@Glavo you're still planning to work on this feature ? If that's the case, I can wait a bit before starting a 2.5.0 release.
@Glavo you're still planning to work on this feature ? If that's the case, I can wait a bit before starting a 2.5.0 release.
I don't think it can be done in a short time. If I don't find a workaround, I need to wait for GraalVM to solve #7507, or give up on what I'm trying and explore something else.
hmm, I found another easier way. I'll give it a quick try and if it works I'll report the results here.
@gnodet I think #269 is more promising, please wait for me.
We have a picocli-based application for which we build native images for Windows, Linux & MacOS using GraalVM. For various reasons, we build a statically linked executable for Linux, and dynamically linked executables for Windows/MacOS.
We would like to add Jansi (and JLine) to our application. Jansi 2.4.0 works just fine for our dynamically linked executables, however it fails to load the native jansi library in the statically linked executable because
musl
apparently doesn't support dynamic library loading (see https://github.com/oracle/graal/issues/4028#issue-1055983935):Apart from this issue, it's also just more logical to statically link the Jansi library when building native images, to avoid dynamic extraction of the library to a temporary directory and then loading it.
Based on what I've read so far, I think the following would be needed:
JNI_OnLoad
(for dynamic linking) orJNI_OnLoad_jansi
(for static linking)Makefile
to add support for buildinglibJansi.a
/jansi.lib
files.a
/.lib
files, to avoid users having to build these themselvesSystem.loadLibrary("jansi")
(either always try, or use a system property to decide between this and the originalSystem.load(path)
-based approach)org.graalvm.nativeimage:svm
dependency@AutomaticFeature
(alternatively, publish a newjansi-<version>-static-feature.jar
artifact that readily includes this feature, such that users can simply add this as a dependency)-H:CLibraryPath=/path/to/dir/containing/libJansi.a
option tonative-image
invocationFor reference, some links related to statically linking JNI libraries: