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

Graal image needs hint for libjnidispatch.so on Linux #843

Open
jvalkeal opened this issue Jun 3, 2023 · 0 comments
Open

Graal image needs hint for libjnidispatch.so on Linux #843

jvalkeal opened this issue Jun 3, 2023 · 0 comments

Comments

@jvalkeal
Copy link
Contributor

jvalkeal commented Jun 3, 2023

Previously with 3.21.0 you didn't need to add resource hints for jna libs on a Linux. This was nice as you don't need to bundle things you don't need.

With 3.23.0 if libjnidispatch.so is not resolvable from an image a dump terminal is created.

2023-06-03T15:42:35.283+01:00 DEBUG 25192 --- [main] com.sun.jna.Native                       : Looking in classpath from jdk.internal.loader.ClassLoaders$AppClassLoader@f5f2bb7 for /com/sun/jna/linux-x86-64/libjnidispatch.so
2023-06-03T15:42:35.292+01:00  WARN 25192 --- [main] org.jline                                : input is tty: {}true
2023-06-03T15:42:35.292+01:00  WARN 25192 --- [main] org.jline                                : output is tty: {}false
2023-06-03T15:42:35.292+01:00  WARN 25192 --- [main] org.jline                                : error is tty: {}false
2023-06-03T15:42:35.292+01:00  WARN 25192 --- [main] org.jline                                : Creating a dumb terminal

Simply adding hint for libjnidispatch.so gets you a PosixSysTerminal. There's additional errors as I didn't add graal jni hints.

2023-06-03T17:12:06.736+01:00 DEBUG 20066 --- [main] com.sun.jna.Native                       : Looking in classpath from jdk.internal.loader.ClassLoaders$AppClassLoader@f5f2bb7 for /com/sun/jna/linux-x86-64/libjnidispatch.so
2023-06-03T17:12:06.736+01:00 DEBUG 20066 --- [main] com.sun.jna.Native                       : Found library resource at resource:/com/sun/jna/linux-x86-64/libjnidispatch.so
2023-06-03T17:12:06.736+01:00 DEBUG 20066 --- [main] com.sun.jna.Native                       : Extracting library to /home/jvalkealahti/.cache/JNA/temp/jna10043564291288107886.tmp
2023-06-03T17:12:06.737+01:00 DEBUG 20066 --- [main] com.sun.jna.Native                       : Trying /home/jvalkealahti/.cache/JNA/temp/jna10043564291288107886.tmp
2023-06-03T17:12:06.737+01:00 DEBUG 20066 --- [main] com.sun.jna.Native                       : Found jnidispatch at /home/jvalkealahti/.cache/JNA/temp/jna10043564291288107886.tmp
2023-06-03T17:12:06.743+01:00 DEBUG 20066 --- [main] org.jline                                : Error creating jna based terminal: Structure.getFieldOrder() on class org.jline.terminal.impl.jna.linux.CLibrary$termios returns names ([c_cc, c_cflag, c_iflag, c_ispeed, c_lflag, c_line, c_oflag, c_ospeed]) which do not match declared field names ([])

java.lang.Error: Structure.getFieldOrder() on class org.jline.terminal.impl.jna.linux.CLibrary$termios returns names ([c_cc, c_cflag, c_iflag, c_ispeed, c_lflag, c_line, c_oflag, c_ospeed]) which do not match declared field names ([])
        at com.sun.jna.Structure.getFields(Structure.java:1122) ~[spring-shell-samples:5.13.0 (b0)]



2023-06-03T17:12:06.762+01:00 DEBUG 20066 --- [main] org.jline                                : Registering shutdown-hook: Thread[JLine Shutdown Hook,5,main]
2023-06-03T17:12:06.762+01:00 DEBUG 20066 --- [main] org.jline                                : Adding shutdown-hook task: org.jline.terminal.impl.PosixSysTerminal$$Lambda$ed1978c058246167f7b76bed6f10a8df8e337aa6@6089f7a9
2023-06-03T17:12:06.762+01:00 DEBUG 20066 --- [main] org.jline                                : Using terminal PosixSysTerminal
2023-06-03T17:12:06.763+01:00 DEBUG 20066 --- [main] org.jline                                : Using pty ExecPty

I was looking recent changes in a TerminalBuilder but got a bit confused what actually happens. Looks like jna side is not actually needed but something goes south during the initialisation phase.

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

1 participant