Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 1.5 issue "undefined symbol: libusb_init" on Linux #31

Closed
andyrozman opened this issue Sep 22, 2015 · 7 comments
Closed

Java 1.5 issue "undefined symbol: libusb_init" on Linux #31

andyrozman opened this issue Sep 22, 2015 · 7 comments
Assignees
Milestone

Comments

@andyrozman
Copy link

Hi !

I used 0.3.1 for testing so far, now my library (classes) is ready for production, so I build 0.4.0 version locally, but now when I try to run it, I get problem with binary file (I use linux-amd64). This is what I get...

symbol lookup error: /home/andy/workspaces/andy-iplayground4/ggc/hid4java/target/classes/linux-amd64/libhidapi.so: undefined symbol: libusb_init

Do I need any special dependencies on system to run with new version?

And before you ask, I build my own version because I need 1.5 compatibility.

Andy

@gary-rowe gary-rowe changed the title problem with binary Java 1.5 issue "undefined symbol: libusb_init" on Linux Sep 22, 2015
@gary-rowe
Copy link
Owner

This could be due to the libusb library being renamed on your system, possibly to include the version number. You can test this by means of ls /usr/lib/libusb*.a and seeing if /usr/lib/libusb-1.0.a or similar is present in the result.

You might be able to use the instructions in this Stack Overflow question to work out what you need to do on your system to overcome this situation. One answer suggests using LD_PRELOAD.

@andyrozman
Copy link
Author

But why would 0.3.1 work and 0.4.0 not... When I use official version of 0.3.1 it works, when I use 0.4.0 I rebuilt not...
Actually I don't have any files like this.

@andyrozman
Copy link
Author

I tried using 0.3.1 binaries with 0.4.0 java sources. This one works better, but read command doesn't work. I have seen that there were some changes (HidDeviceInfo file was removed), which might be reason why read command doesnt work (I get -2 returned instead of data)...

Did you change how you make binaries from 0.3.1 till next (current) version?

@gary-rowe
Copy link
Owner

Hmm, looking over 0.3.1 there's nothing in the pom.xml to indicate a change. Both Java 6 and JNA 4.1.0 were in place by that time (0.3.0 required Java 7+ but this was later relaxed).

If you got the binaries from the Bitcoin Solutions staging repo (as referenced in the README) then it's possible that later ones were compiled under Java 8 targeting a Java 6 language level and byte code format.

From the look of the error message it's a problem with the dynamic linking between the signal11/hidapi library and your libusb. I've no idea why earlier binaries were working unless something changed on your system between when you compiled them and now. Perhaps it would be worth re-compiling the old ones and seeing if they still work?

@andyrozman
Copy link
Author

I didn't compile binaries. I just took them from your jar file. Now I took them from your repository... they are stored under src/main/resources.
Situation really seems weird... I will try to get old sources and recompile them and see if it works...

@andyrozman
Copy link
Author

I recompiled with old sources 0.3.1 (and using also old binaries) and it works now (not with new ones, it seems like you might be correct, perhaps new binaries are targeting higher java version)... Since I need this for java 5 I made fork of this project, which is now "locked" at 0.3.1. I will merge changes if you make some, but since you also changed Java implementation from 0.3.1 to 0.4 I will have to be very carefull...

If someone needs Java 5 version it has name hid4java-j15 (here on github)...

You can close this ticket... Thanks for your help and you did good work with this library... Start of using USB hid in my project was much easier than I expected.

@gary-rowe
Copy link
Owner

OK. Thanks for the feedback. Closing.

@gary-rowe gary-rowe added this to the Support milestone Nov 11, 2015
@gary-rowe gary-rowe self-assigned this Nov 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants