0

Im working on a "UsbScopeNode" on a Raspberry Pi - a Raspberry Pi which gathers data with a plugged in Usb Scope. The Usb Scope is the HS4 from tiepie :

I programmed the first steps on my windows pc and made it to the point where i was able to get the data , settings and everything. So I decided to switch to the arm library. But now I seem to have problems with jna on my raspberry pi. The very small program crashes when I am trying to load the library. My code to load the library looks as follows:

LibTiePieHS4Library INSTANCE = (LibTiePieHS4Library) Native.loadLibrary((Platform.isARM()? "libtiepie" : "c"), LibTiePieHS4Library.class);

Its almost the same as I used for the version under windows but in this case the libtiepie is a ".so" file and not a dll.

Im getting following Error Message from my code:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/jna-3577/jna3799405475131998919.tmp: /tmp/jna-3577/jna3799405475131998919.tmp: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    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 Ftest_USBScope.controller.LibTiePieHS4Library.<clinit>(LibTiePieHS4Library.java:17)
    at Ftest_USBScope.controller.HS4.<init>(HS4.java:48)
    at Ftest_USBScope.controller.ScopeNodeManager.initializeScopes(ScopeNodeManager.java:85)
    at Ftest_USBScope.controller.ScopeNodeManager.<init>(ScopeNodeManager.java:43)
    at Ftest_USBScope.main.Main_USBScope.main(Main_USBScope.java:14)

Jna on the R-Pi is installed and i followed the setup steps from tiepie for the library installation.

Installationguide for library: http://www.tiepie.com/en/software/LibTiePie_02x#s4

library API: http://api.tiepie.com/libtiepie/0.2.2/

I hope someone can help me and I'd be happy to deliver more details if necessary

thanks, soc

  • `loadLibrary` wants the library name, which should be the filename *without* the `lib` prefix and `.so` suffix. – technomage Jul 17 '13 at 17:10
  • Your system is failing to load libjnidispatch.so after unpacking it from the jar file into a temporary location. Examine the file at the unpacked location to determine if it's missing read or execute permission, or if it's depending on a version of glibc newer than what you have (`ldd`). – technomage Jul 17 '13 at 17:11
  • hey @technomage, thanks for the fast response! the lib in "libtiepie" belongs to the filename, it's their official library. I tried to give the tmp location the required permissions still nothing, I'll try updating the R-pi as soon as I get access to the internet with it. – SonOfChaos Jul 18 '13 at 06:30
  • The filename is `libtiepie.so`, so you need to use "tiepie". You will discover this once you get beyond the first error. – technomage Jul 18 '13 at 08:54
  • You may also install the linux-arm version of libjnidispatch.so in `LD_LIBRARY_PATH`. This is actually preferable on embedded devices to having JNA unpack a temporary file on every run. – technomage Jul 18 '13 at 08:55
  • Maybe I should mention I'm not very good at programming or working with linux... I have no idea how to get past the first error. And where do I find the libjnidispatch.so and how do I install it in LD_LIBRARY_PATH? – SonOfChaos Jul 18 '13 at 09:43
  • [Set LD_LIBRARY_PATH](http://stackoverflow.com/questions/830542/ld-library-path) to include a directory which includes libjnidispatch.so. You can find the latter in jna.jar under `/com/sun/jna/linux-arm/libjnidispatch.so`. – technomage Jul 18 '13 at 11:02
  • After a small break I tried it again, inclusive reinstalling the R-Pi with the newest version and all, installed jna, created a script for LD_LIBRARY_PATH, but it is still not working... – SonOfChaos Jul 24 '13 at 08:52
  • With JNA 4.0, you can set the system property `jna.debug_load.jna` to see where JNA is looking for its native support. That may indicate where and/or why it's failing. – technomage Jul 24 '13 at 15:28
  • Run `ldd` on the `jnidispatch` library it's attempting to load to see if perhaps there's an unresolved shared library dependency. – technomage Jul 24 '13 at 15:29

0 Answers0