Closed ajalt closed 2 months ago
It doesn't say much in the logs, but maybe it is because we're missing some --initialize-at-build-time
flags
Those are also needed with Graal 21 if we enable the new behavior --strict-image-heap
I use those ones
https://github.com/hubvd/odoo-tools/blob/master/buildSrc/src/main/kotlin/NativeImageConvention.kt#L29-L33
(I guess those names are not up to date, for example com.github.ajalt.mordant.internal.syscalls.nativeimage.SyscallHandlerNativeImageLinux
becomes com.github.ajalt.mordant.terminal.terminalinterface.TerminalInterfaceNativeImageLinux
)
I haven't made a PR, as I'm not sure if we can pass every flag for every platform. If it's the case, we could add them to the native-image.properties.
If not, I guess we could implement org.graalvm.nativeimage.hosted.Feature
Ok, so It had nothing to do with that (even if the flags are still required)
The output when running locally is
GraalSmokeTest > terminal detection test() FAILED
org.opentest4j.AssertionFailedError: Incorrect terminal interface: TerminalInterfaceJnaLinux
at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38)
at app//org.junit.jupiter.api.Assertions.fail(Assertions.java:138)
at app//kotlin.test.junit5.JUnit5Asserter.fail(JUnitSupport.kt:56)
at app//kotlin.test.AssertionsKt__AssertionsKt.fail(Assertions.kt:520)
at app//kotlin.test.AssertionsKt.fail(Unknown Source)
at app//com.github.ajalt.mordant.graalvm.GraalSmokeTest.terminal detection test(GraalSmokeTest.kt:28)
Since the test runs two times, we can do something like this https://github.com/ajalt/mordant/pull/186#discussion_r1669341639
But then I have another weird error
The build process encountered an unexpected error... :
> java.lang.IncompatibleClassChangeError: com.github.ajalt.mordant.terminal.terminalinterface.WinKernel32Lib and com.github.ajalt.mordant.terminal.terminalinterface.WinKernel32Lib$EventUnion disagree on InnerClasses attribute
I might do a PR tomorrow
Thanks for looking into it! I implemented your suggestions, and ended up with the same error. The only lead I have right now is that the uChar
and Event
declarations are unions nested inside structs in C. Removing the CStruct
annotations from those two interfaces is enough to get linux working, but that obviously breaks windows. I'll need to investigate some more.
I made a PR that should hopefully solve those issues https://github.com/ajalt/mordant/pull/201
Hm, looks like the graal test isn't running on nativeimage, it's just the regular JVM. The only GHA change was to go from JDK 21 -> 22, so not sure why that would have broken...