You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browsing the source code, I think the problem is with the way NativeResource tries to locate and load the native library (see source).
The issue seems to be that it naively loops through all the 32-bit native library variants, trying to load each until it succeeds. However, the mere fact of trying to load an incorrect native library seems to crash the JVM.
Workaround: extract libNRJavaSerialv5.so from the JAR file (or download from GitHub), place it somewhere in the file system and add a system property to the JVM command line arguments: -DlibNRJavaSerial.userlib=/path/to/native/libNRJavaSerialv5.so (replace /path/to/native with the location where you stored the downloaded native library).
Proper fix: add a system property (e.g. libraryName + ".classpathlib") to force loading a specific native library from the classpath, skipping the incompatible libraries. I'll open a pull request for this.
Even better fix would be to auto-detect the correct version (somehow jSerialComm manages to achieve this) but I'm happy with the system property.
The text was updated successfully, but these errors were encountered:
Machine: ARMv5 machine (
uname
tellsarmv5tejl
).JVM:
Versions affected: I tried with
org.openhab:nrjavaserial:3.15.0.OH2
andcom.neuronrobotics:nrjavaserial:5.2.1
- same result.I cannot do anything with
nrjavaserial
, it crashes the JVM.Simple test program:
Result, JVM crash with:
Browsing the source code, I think the problem is with the way
NativeResource
tries to locate and load the native library (see source).The issue seems to be that it naively loops through all the 32-bit native library variants, trying to load each until it succeeds. However, the mere fact of trying to load an incorrect native library seems to crash the JVM.
Workaround: extract libNRJavaSerialv5.so from the JAR file (or download from GitHub), place it somewhere in the file system and add a system property to the JVM command line arguments:
-DlibNRJavaSerial.userlib=/path/to/native/libNRJavaSerialv5.so
(replace/path/to/native
with the location where you stored the downloaded native library).Proper fix: add a system property (e.g.
libraryName + ".classpathlib")
to force loading a specific native library from the classpath, skipping the incompatible libraries. I'll open a pull request for this.Even better fix would be to auto-detect the correct version (somehow jSerialComm manages to achieve this) but I'm happy with the system property.
The text was updated successfully, but these errors were encountered: