java.lang.UnsatisfiedLinkError: /tmp/usb4java8921351078720260954.tmp/libusb4java.so

557 views
Skip to first unread message

bertel...@googlemail.com

unread,
Mar 11, 2014, 7:26:44 AM3/11/14
to usb4...@googlegroups.com
Hi there,

first, thanks for your great work concering usb4java. It works perfect on Win7.

But now, i try to run a simple program on a raspberry pi (raspian), and get the mentioned ( java.lang.UnsatisfiedLinkError: /tmp/usb4java8921351078720260954.tmp/libusb4java.so) error. I also tried everyting mentioned in:

https://github.com/usb4java/usb4java/issues/30

- i installed libusbx (compiled it on the pi)
- i tried to change the tmp-dir (-Djava.io.tmp.....)
- i checked out the source files form git and tried to compile the c sources, BUT no sources under src/main/c were found. (dir is not there)

If i look into the jar, i see, that the mentioned file (libusb4java.so) is inside, but it isn't copied to the tmp.

I'm executing my program as root (so missing permisions, couldn't be the reasion).

If you have additional questions regarding program, os, etc. pleas ask.

PLEASE help, i'm totaly stuck on this.

Thanks in advance

Klaus

Klaus Reimer

unread,
Mar 11, 2014, 8:03:44 AM3/11/14
to usb4...@googlegroups.com
On 03/11/2014 12:26 PM, bertel...@googlemail.com wrote:
> - i installed libusbx (compiled it on the pi)
> - i tried to change the tmp-dir (-Djava.io.tmp.....)
> - i checked out the source files form git and tried to compile the c
> sources, BUT no sources under src/main/c were found. (dir is not there)

I guess you checked out the HEAD. This is the source of the upcoming
version which has a different project layout. You have to checkout the
"usb4java-1.0.0" tag if you need the source for the current version.

Actually I have no idea what can cause this problem. I can't reproduce
this on my own Raspberry Pi. So I can only give you two advises you can try:

1. Try to use the library in extracted form. Extract the so/dll/dylib
files into a directory (Directory-structure inside the JAR must be
retained) and include this directory in your class path. Then usb4java
can load the library directly and doesn't need to copy it into a
temporary directory. See http://usb4java.org/nativelibs.html for details.

2. Try again with the current 1.2.0-SNAPSHOT version. I wrote a mail a
few days ago which explains the changes made and where to download it.
See https://groups.google.com/forum/#!topic/usb4java/hydnAmxMIm0
Maybe we fixed the problem accidentally.

--
Klaus Reimer <http://www.ailis.de/~k/>
[2FC4 CCA0 C03B 1E5F 1ACC 94D6 6461 426C E734 75A1]

bertel...@googlemail.com

unread,
Mar 11, 2014, 8:51:42 AM3/11/14
to usb4...@googlegroups.com
I tried the 1.2.0-SNAPSHOT.

first good news is: the UnsatisfiedLink-Error ist gone :-) BUT...

on Win 7 it always run fine, but on the pi i'm now getting

"USB error 6: Unable to claim interface: Resource busy"

(I shutdown the Pi, restart it, and plugin the usb device)

Klaus Reimer

unread,
Mar 11, 2014, 9:03:49 AM3/11/14
to usb4...@googlegroups.com
Hi,

On 03/11/2014 01:51 PM, bertel...@googlemail.com wrote:
> first good news is: the UnsatisfiedLink-Error ist gone :-) BUT...
> on Win 7 it always run fine, but on the pi i'm now getting
> "USB error 6: Unable to claim interface: Resource busy"

Sounds like some other driver has claimed the device.

If you use the high-level API you should enforce the claim like this:

iface.claim(new UsbInterfacePolicy()
{
@Override
public boolean forceClaim(UsbInterface usbInterface)
{
return true;
}
});

When you use the low-level API then you need to do this:

// Detach kernel driver from interface. This can fail if
// kernel is not attached to the device or operating system
// doesn't support this operation. These cases are ignored here.
result = LibUsb.detachKernelDriver(handle, 1);
if (result != LibUsb.SUCCESS &&
result != LibUsb.ERROR_NOT_SUPPORTED &&
result != LibUsb.ERROR_NOT_FOUND)
{
throw new LibUsbException("Unable to detach kernel driver",
result);

bertel...@googlemail.com

unread,
Mar 11, 2014, 10:35:49 AM3/11/14
to usb4...@googlegroups.com
I'm using the high level api.

IT WORKS !!!!

many, many thanks for the superfast help.
Reply all
Reply to author
Forward
0 new messages