-
Notifications
You must be signed in to change notification settings - Fork 15
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
java.jang.UnsatisfiedLinkError in macOS Monterey (Apple Silicon) #8
Comments
I also tried installing a different version of OpenJDK from the link in the README and had the same output there: ❯ /Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java -jar ~/Downloads/ModbusMechanic/ModbusMechanic.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/tb/dc9bcxw57mlf9_5s6ffd1kx80000gn/T/jna--87988168/jna2915415394505014223.tmp
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2398)
at java.base/java.lang.Runtime.load0(Runtime.java:785)
at java.base/java.lang.System.load(System.java:1979)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:761)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:736)
at com.sun.jna.Native.<clinit>(Native.java:131)
at jtermios.macosx.JTermiosImpl.<clinit>(JTermiosImpl.java:55)
at jtermios.JTermios.<clinit>(JTermios.java:317)
at purejavacomm.CommPortIdentifier$1.<init>(CommPortIdentifier.java:200)
at purejavacomm.CommPortIdentifier.getPortIdentifiers(CommPortIdentifier.java:193)
at com.intelligt.modbus.jlibmodbus.serial.SerialPortFactoryPJC.getPortIdentifiersImpl(SerialPortFactoryPJC.java:45)
at com.intelligt.modbus.jlibmodbus.serial.SerialPortAbstractFactory.getPortIdentifiers(SerialPortAbstractFactory.java:55)
at com.intelligt.modbus.jlibmodbus.serial.SerialUtils.getPortIdentifiers(SerialUtils.java:67)
at modbusmechanic.ModbusMechanic.getPortNames(ModbusMechanic.java:131)
at modbusmechanic.PacketFrame.getPortNames(PacketFrame.java:1662)
at modbusmechanic.PacketFrame.initComponents(PacketFrame.java:239)
at modbusmechanic.PacketFrame.<init>(PacketFrame.java:74)
at modbusmechanic.ModbusMechanic.main(ModbusMechanic.java:114) |
Hi, Thanks for reporting the issue. I did some research and this appears to be related to that JNA version not supporting the Apple Silicon architecture. I'll update JNA to a newer version which should resolve the error in the next release. If you want to update it on your own as a provisional workaround, just replace the JNA bundle with 5.7.0 or newer and update the manifest.txt to include the library's path. I only have access to x86 Apple hardware, so I cannot test. |
Unfortunately it may not be that simple. I am guessing that JNA might have some breaking API changes, because it changes the error to: ❯ java -jar /Applications/ModbusMechanic/ModbusMechanic.jar
Exception in thread "main" java.lang.NoSuchMethodError: 'void com.sun.jna.Native.setPreserveLastError(boolean)'
at jtermios.macosx.JTermiosImpl.<clinit>(JTermiosImpl.java:55)
at jtermios.JTermios.<clinit>(JTermios.java:317)
at purejavacomm.CommPortIdentifier$1.<init>(CommPortIdentifier.java:200)
at purejavacomm.CommPortIdentifier.getPortIdentifiers(CommPortIdentifier.java:193)
at com.intelligt.modbus.jlibmodbus.serial.SerialPortFactoryPJC.getPortIdentifiersImpl(SerialPortFactoryPJC.java:45)
at com.intelligt.modbus.jlibmodbus.serial.SerialPortAbstractFactory.getPortIdentifiers(SerialPortAbstractFactory.java:55)
at com.intelligt.modbus.jlibmodbus.serial.SerialUtils.getPortIdentifiers(SerialUtils.java:67)
at modbusmechanic.ModbusMechanic.getPortNames(ModbusMechanic.java:131)
at modbusmechanic.PacketFrame.getPortNames(PacketFrame.java:1662)
at modbusmechanic.PacketFrame.initComponents(PacketFrame.java:239)
at modbusmechanic.PacketFrame.<init>(PacketFrame.java:74)
at modbusmechanic.ModbusMechanic.main(ModbusMechanic.java:114) |
I was able to reproduce that exact error in 2.2 after replacing the JNA library. I updated the upstream serial library for the new API bindings and I no longer got errors with the newer JNA in v2.2.1 which is now posted. Now that it launches, 2.2.1 should support your M1 arch. Let me know if you still get errors. |
Yes! It works, thank you :) |
Describe the bug
Double-clicking (after right-click > open for first time launch) crashes with an error asking to look at console.
Executing from CLI:
Setting class path explicitly to the included
lib
directory does not change the error.To Reproduce
I merely unzipped the latest release, and then as above.
Expected behavior
App launches
Screenshots
The pop-up macOS gave about looking at console only happened on first launching via right-click > Open and confirming. Unfortunately it doesn't pop up again so I can't get a screenshot
Desktop (please complete the following information):
Java Runtime Version
Additional context
The text was updated successfully, but these errors were encountered: