is it somehow possible to install the libusb library on the ctrlX CORE? (Or any other library)
Since apt is not available on the core and it is not enough to stage this library within a snap (as far as I know), I tried to manually copy the files to '/lib' and '/usr/lib' through ssh with a root user. But that doesn't work either (cp: cannot create regular file '/lib/aarch64-linux-gnu/libusb-1.0.so.0': Read-only file system).
Any other workarounds?
Thanks for your help!
Solved! Go to Solution.
In general there are some snaps available on GitHub that uses this lib.
You need the library as stage package and use the plug [raw-usb]. It should be auto connected but as you have root access you could also do it by hand.
Could you please try to set "LD_LIBRARY_PATH=$SNAP/lib...." so the path to the library is known in the snap.
Further it would be good to have some debug information. Please, do a 'set PYUSB_DEBUG=debug' on the command line to define the PYUSB_DEBUG environment variable and post the output. (See snapcraft bug)
Still not working. I also tried to set the environment variable directly on the command line (export LD_LIBRARY_PATH=/snap/mouse-example/current/lib/aarch64-linux-gnu/) but without any success.
Also, 'set PYUSB_DEBUG=debug' doesn't change the output.
I have already tried the suggestions from github and https://forum.snapcraft.io but none of them worked. That's why I thought, this could be an issue specific to the ctrlX CORE (or Ubuntu Core). Both of them don't have the libusb library directly on the system.
I really appreciate your help, do you have any other suggestions?
Something I noticed during the build process of the snap:
- "Unable to determine library dependencies for ...", this is something I have seen in other cross-builds as well, but the snaps worked fine.
- "not a dynamic executable", this could be an issue, since I have never seen this in other builds.
I had a quick look into the topic. It seems like pyusb is "hardcoding" where to find the libusb, but you can provide it by code:
backend = usb.backend.libusb1.get_backend(find_library=lambda x: "/snap/my-snap-name/current/lib/x86_64-linux-gnu/libusb-1.0.so.0")
Does this work for you?
Actually, I have tried this solution (https://github.com/pyusb/pyusb/pull/29) before and it didn't work. But for some odd reason, it works now.
Nevertheless, thank you for your help!
If you don't mind, there is an other issue where I need help.
Even though the specified usb-mouse with the correct vendor- and product-id is connected to the ctrlX CORE, somehow it is not recognized within the snap.
(Again, this problem doesn't occur with the mouse connected to the Ubuntu-VM.)
I was able to solve the problem with an additional plug in snapcraft.yaml
But I don't know why the 'hardware-observe'-plug is only necessary on the ctrlX CORE and not on the Ubuntu-VM.