Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.35k stars 287 forks source link

not working on armv7l #208

Closed amir-hg closed 5 years ago

amir-hg commented 5 years ago

Hi when I call this function SerialPort.getCommPorts(); i get the fowolling error

Caused by: java.lang.UnsatisfiedLinkError: /tmp/1555404181319-libjSerialComm.so: /tmp/1555404181319-libjSerialComm.so: cannot open shared object f ile: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.fazecast.jSerialComm.SerialPort.(SerialPort.java:248)

And linux architecture is : Linux FriendlyELEC 4.4.49-s5p6818 #4 SMP PREEMPT Sun Mar 24 14:12:46 +0430 2019 armv7l armv7l armv7l GNU/Linux

my current version library: 2.5.0 (from maven)

AliGeenius commented 5 years ago

Hi, have you already set all necessary permissions for port usage? I'm using this library without any detection problems on armv7l.

amir-hg commented 5 years ago

Hi What permissions required ? I only added user to dialout and tty group? Should i do something else?

hedgecrw commented 5 years ago

That should be enough; however, try running your application under root or using sudo. If it works then, then it's definitely a permissions issue.

sfiruch commented 5 years ago

Hitting the same problem on a NanoPI M4. Running the program as root makes no difference. This is armv8_32. The catch here https://github.com/Fazecast/jSerialComm/blob/53449d43bcbcf3396079752469a0ac276b8f5e83/src/main/java/com/fazecast/jSerialComm/SerialPort.java#L244 looks odd...

hedgecrw commented 5 years ago

Very odd indeed. I have no idea off the top of my head. I may need to purchase a NanoPI M4 so I can replicate on my end to solve this issue.

hedgecrw commented 5 years ago

I'm still not able to reproduce this issue. @deiruch could you post the output of both cat /proc/cpuinfo and uname -a from your device please?

sfiruch commented 5 years ago

Here you go:

# cat /proc/cpuinfo

processor       : 0
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 48.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt lpae evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 48.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt lpae evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 48.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt lpae evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 48.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt lpae evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 4
model name      : ARMv8 Processor rev 2 (v8l)
BogoMIPS        : 48.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt lpae evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd08
CPU revision    : 2

processor       : 5
model name      : ARMv8 Processor rev 2 (v8l)
BogoMIPS        : 48.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt lpae evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd08
CPU revision    : 2
# uname -a
Linux hostname 4.4.143 #32 SMP Mon Feb 4 13:08:20 CET 2019 aarch64 aarch64 aarch64 GNU/Linux

The aarch64 is confusing, as I'm running an aarch32hf Zulu JVM

hedgecrw commented 5 years ago

Thanks for all of that...extremely helpful! Turns out your hunch was exactly right...your CPU is reporting itself as an aarch64 device but your JVM is running in 32-bit HF mode. It looks like there is a system property that can be used to retrieve this information in mobile Java on ARM devices, so I implemented those changes and they are available as part of the new 2.5.2 release. Please test out your application with the newest code and close this issue if it appears to be working for you. Thanks!

hedgecrw commented 5 years ago

Can no longer reproduce so assuming this was resolved with the updates in v2.5.2. Please re-open if still experiencing the problem.

rL071 commented 4 years ago

Hi, How did you succeed in resolving the problem? Thanks in advance.

cmoine commented 3 years ago

I still have the problem with 2.7.0. I am using raspberry pi os, and changed back the option arm_64bit=0 in /boot/config.txt for the moment. Since it is quite specific problem, I wouldn't say it is critical. But would be nice though to be able to somehow "force" which library is loading with a resource file in the classpath for instance (already had a short look at the source code ;) )

cmoine commented 3 years ago

Oups just saw it was already possible to specify which library is loaded by defined os.arch_full system property, 👍

AAstroPhysiCS commented 2 years ago

The issue persists with 2.7.0. I am also using raspberry pi os with the flag arm_64bit enabled.

The exception that is being thrown is down below: /tmp/jSerialComm/1641474161877-libjSerialComm.so: /tmp/jSerialComm/1641474161877-libjSerialComm.so: cannot open shared object file: No such file or directory

hedgecrw commented 2 years ago

Please retry with the newly released v2.8.0.