gluonfx-maven-plugin
gluonfx-maven-plugin copied to clipboard
Include -libjnidispatch.jnilib
Hey,
I am trying to link a maven project that contains a reference net.java.dev.jna:jna.
<resourcesList>
<list>com/sun/jna/darwin.*</list>
</resourcesList>
However, I get;
...ignoring file ../ target/client/x86_64-darwin/gvm/lib/libjnidispatch.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x01 0xDF 0x00 0x05 0x5D 0x0E 0x1F 0x06 0x00 0x04 0x4E 0xC0 0x00 0x00 0x2A 0x39 )
Which is obviously because it is finding the ppc_64 version. Am I missing something?
Thanks for any help!
The resources list requires a pattern, but this applies only to regular resource files. The static native libraries (*.a
), however, are all included.
On certain platforms (Linux, Android, iOS) there is a check for the correct format. Are you building for MacOS?
Is that a warning or an error in the link phase?
@jperedadnr yes to both macOS and a warning. The phase completes but the binary fails to execute citing the missing library.
I have the same issue and yes it is on macOS. The aix-ppc and aix-ppc64 libraries are the problem.
While this should be done by the plugin, like mentioned above, in the meantime GraalVM 21.0 comes with a new flag that allows excluding resources. Maybe you could give it a try?
Adding <nativeImageArg>-H:ExcludeResources='.*/libjnidispatch.a$'</nativeImageArg>
to the <nativeImageArgs>
in the Maven POM did not do the trick. Actually it did not change anything. Do you mean some other flag?
Right, that won't solve it. I meant that flag, yes, but that would have worked for other files like dynamic libraries. For static libraries, we scan from Substrate all *.a files in the jars. Again, we still need to verify the library is valid for the platform, as we already do for other platforms.
Regarding JNA the issue mentioned here will not affect if JNA will work with the native image or not, @amahfouz1 found a solution that works (JNA with native image), you can see his solution here https://github.com/amahfouz1/jna-graalvm