-
Notifications
You must be signed in to change notification settings - Fork 72
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
Support RPi OS "bullseye" aarch64; support old glibc versions #150
Comments
I am looking at https://github.com/gary-rowe/hid4java/wiki/How-to-set-up-cross-compilation-of-hidapi-using-Docker and I could probably help provide a build of libhidapi.so for armhf, which I see is missing in https://github.com/gary-rowe/hid4java/tree/hid4java-0.8.0/src/main/resources but it seems from the stacktrace that there is an issue that appears even before the libhidapi shared library is even loaded... What would be required to make this work? |
Thanks for your feedback @gary-rowe. I picked this up again, as getting a better hid solution working on rpi buster 32 bit to run is quite crucial for our usecase. When I wrote this issue I had actually only tested it on bullseye 64 bit which reproducibly produces the problem above. I had foolishly assumed that this would imply it won't work on 32 bits and the older buster (buster < bullseye < bookworm) rpi os either... However, it turns out that on the older buster rpi OS with 32 bits (armhf/armv7l) hid4java actually works out of the box which is very good news for us. So actually, the problem only exists on aarch64/bullseye. I checked that JNA works fine on all the platforms I care about (rpi buster+, 23 & 64 bit arm), it really seems the only issue is that the libhidapi*.so included in hid4java/linux-aarch64 are built against an unnecessarily recent glibc (inconsistent with the glibc version required by the arm 32 bit which is an earlier version): Running ldd on the .so on aarch64 bullseye shows the problem
FWIW, I have created some minimal example projects for the two libraries in case someone wants to try this on other platforms: |
So I think the solution would indeed be to provide builds of the aarch64 .so built against older glibc, correct? I am actually not sure how forward compatibility of the dynamic glibc library dependency is ensured, but it seems it's a given? |
After doing a bit more research, I think switching from dockcross/linux-arm64 to dockcross/linux-arm64-lts mit solve the problem as the latter depends on an older version of libc https://github.com/gary-rowe/hid4java/blob/develop/build-hidapi.sh https://github.com/dockcross/dockcross?tab=readme-ov-file#summary-cross-compilers is there any reason not to use the -lts version of all the cross-compilers? I think it would be awesome if this low-level library had such great compatibility like https://github.com/usb4java/usb4java which we have been using for years (last release from 6 years ago still working fine). I think this project would also deserve to be at hid4java/hid4java and hid4java.org. |
Is your feature request related to a problem? Please describe.
First of all, thanks for creating this; very close to what I am looking for.
I just started playing around with this trying to get rid of some native code (a C REST server and a JNI shared library) which is using libusb/hidapi-0.14.0 directly and implements higher-level functionality on top of our custom inhouse HID report format protocol (exchange of 64 byte reports with a custom device).
It works out of the box on Windows 10 x64 and Ubuntu 22.04 which are my dev environments. Unfortunately my target is RPi (Raspberry Pi) OS buster, armhf (yes it's a bit old... it's out in the field, tricky to update...). My other rpi target is rpi bullseye (bookworm works) on aarch64 architecture and this is the one that's making problems.
Describe the solution you'd like
Describe alternatives you've considered
I imagine it might be a JNA issue, but I really only care about doing USB HID, these technicalities are just a (necessary...) evil, so I reported my issue here where I see it.
Possible alternatives:
I would prefer a community effort where a solution is included in the next maven central release of this library for everyone to
benefit from. I see no reason this library should not be as backwards-compatible as possible.
I would like to help, but I need to be pointed into the right direction. I am familiar with make, cmake, gcc (vaguely with glibc and incompatibilities there...) and JNI, but not JNA or how this library handles the low-level stuff.
Additional context
right now I only have access to an RPi 4 running bullseye aarch64, but I expect the same problem on the even older platform:
system information:
observed behavior:
this is just a simple example application that tries to init hid4java and open a device and talk to it a bit.
The text was updated successfully, but these errors were encountered: