Issues after dispatch initialization (ARM/Pi)

81 views
Skip to first unread message

Pi Fab

unread,
Jan 5, 2017, 8:02:52 PM1/5/17
to Java Native Access
Hello!
Saw many different topics but none really that seemed to point to an issue after the dispatcher was initialized... So I had to create a new topic :(

I tried also to rename the libc library... nothing.

Here is what happens when I run my code:

Looking in classpath from java.net.URLClassLoader@17327b6 for /com/sun/jna/linux-arm/libjnidispatch.so
Found library resource at jar:rsrc:jna-4.3.0-20161231.172136-8.jar!/com/sun/jna/linux-arm/libjnidispatch.so
Trying /tmp/jna-3506402/jna1269380311245223573.tmp
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: /tmp/jna-3506402/jna1269380311245223573.tmp: /tmp/jna-3506402/jna1269380311245223573.tmp: cannot open shared object file: No such file or directory


When I go in the tmp folder, there is nothing - not sure if normal.
The same code on my Intel machine works well (ofc, I recompiled the library I am calling for ARM)

If I try to debug with 4.2.2:
root@Pi:/home/pi# java -Djna.debug_load.jna=true -jar jna-4.2.2.jar
Trying (via loadLibrary) jnidispatch
Looking in classpath from sun.misc.Launcher$AppClassLoader@1909752 for /com/sun/jna/linux-arm/libjnidispatch.so
Found library resource at jar:file:/home/pi/jna-4.2.2.jar!/com/sun/jna/linux-arm/libjnidispatch.so
Trying /tmp/jna-3506402/jna7427852810819838509.tmp
Found jnidispatch at /tmp/jna-3506402/jna7427852810819838509.tmp
Java Native Access (JNA) API Version 4
Version: 4.2.2 (b0)
 
Native: 4.0.1 (1a6047467b59e8748f975e03016ce3d9)
 
Prefix: linux-arm




If I try to debug the latest 4.3.0
root@Pi:/home/pi# java -Djna.debug_load.jna=true -jar jna-4.3.0-20161231.172136-8.jar
Trying (via loadLibrary) jnidispatch
Looking in classpath from sun.misc.Launcher$AppClassLoader@1909752 for /com/sun/jna/linux-arm/libjnidispatch.so
Found library resource at jar:file:/home/pi/jna-4.3.0-20161231.172136-8.jar!/com/sun/jna/linux-arm/libjnidispatch.so
Trying /tmp/jna-3506402/jna3266768890158249845.tmp
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/jna-3506402/jna3266768890158249845.tmp: /tmp/jna-3506402/jna3266768890158249845.tmp: cannot open shared object file: No such file or directory
    at java
.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java
.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
    at java
.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
    at java
.lang.Runtime.load0(Runtime.java:809)
    at java
.lang.System.load(System.java:1086)
    at com
.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:906)
    at com
.sun.jna.Native.loadNativeDispatchLibrary(Native.java:881)
    at com
.sun.jna.Native.<clinit>(Native.java:156)
In both versions however the issue when running my code is the same.
Anybody have found a solution?

Timothy Wall

unread,
Jan 6, 2017, 11:05:34 AM1/6/17
to jna-...@googlegroups.com
The JNA shared library (jna*.tmp) has dependencies on the system libc.  Might be you have an older version.

Run "ldd" on the JNA shared library and compare against your system's version.

It's also recommended to install the JNA shared library somewhere the system can find it, rather than relying on automatic unpacking on every run (which is where the temp files come from).

--
You received this message because you are subscribed to the Google Groups "Java Native Access" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jna-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pi Fab

unread,
Jan 6, 2017, 4:28:41 PM1/6/17
to Java Native Access
Thanks but...
Unfortunately ldd looks good - I have also copied libjnidispatch.so (and removed it from the standard jna jar) to the home folder under com/sun/jna/linux-arm/libjnidispatch.so
It finds the library (does not complain), but still the same error.
I am really about to give up on this one :/

Timothy Wall

unread,
Jan 6, 2017, 5:33:58 PM1/6/17
to jna-...@googlegroups.com
Can you load it in a native program using dlopen?

Matthias Bläsing

unread,
Jan 7, 2017, 10:37:08 AM1/7/17
to Java Native Access
Hey,

I think I know the issue. It looks like the arm binaries were compiled with the wrong tool chain - I build them on debian armel, but the raspberry seems to be build with armhf by default.

I'm setting up the armhf toolchain right now and will give it a spin.

I'll report back when I have a build.

Greetings

Matthias

Matthias Bläsing

unread,
Jan 7, 2017, 3:42:52 PM1/7/17
to Java Native Access
Hey,

Am Samstag, 7. Januar 2017 16:37:08 UTC+1 schrieb Matthias Bläsing

I think I know the issue. It looks like the arm binaries were compiled with the wrong tool chain - I build them on debian armel, but the raspberry seems to be build with armhf by default.

I'm setting up the armhf toolchain right now and will give it a spin.

about 3 hours, two chroots and one cleaned up raspberry-pi later I finally have a binary, that thould fix this issue.

Background: The linux-arm binary was compiled in a linux-arm chroot with debian as the operating system and was was build for the softfloat variant. So first try with debian armhf also failed on the raspberry, as the raspberry pi CPU has an older arch. So another try: a raspbian chroot (basicly debian wheezy compiled for arm6l).

So arm in this case means: arm6l hardfloat.

Please test this version:

http://doppel-helix.eu/jna.jar
 
Thank you

Matthias

Pi Fab

unread,
Jan 7, 2017, 5:29:47 PM1/7/17
to Java Native Access
Thanks Matthias, much better!
I am no longer getting the tmp issue, although still not working as expected... But error is gone. Maybe it is something in my code now - or maybe I should just compile my .so on the raspberry as well (I also compiled it on Debian armel...)
I'll keep you guys posted!

Found library resource at rsrc:com/sun/jna/linux-arm/libjnidispatch.so
Trying /tmp/jna-3506402/jna386555150697451293.tmp
Found jnidispatch at /tmp/jna-3506402/jna386555150697451293.tmp
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
    at
MyApp.Commands.<init>(Commands.java:25)
    at
MyApp.ConfigHandler.<init>(ConfigHandler.java:24)
    at
MyApp.Starter.initialize(Starter.java:124)
    at
MyApp.Starter.access$0(Starter.java:96)
    at
MyApp.Starter$1.run(Starter.java:76)
    at java
.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java
.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java
.awt.EventQueue.access$500(EventQueue.java:97)
    at java
.awt.EventQueue$3.run(EventQueue.java:709)
    at java
.awt.EventQueue$3.run(EventQueue.java:703)
Reply all
Reply to author
Forward
0 new messages