Using libusb with Nerves


I’m using Nerves to build a Raspberry Pi that writes firmware to a different board using stlink. Stlink requires libusb as a dependency. Due to how Nerves works, I’m attempting to compile stlink statically linking with libusb so that it can run dependency-free. However, I’m encountering an issue where stlink cmake’s instructions are unable to find libusb package when attempting to statically link it.

I have tried using dockcross to cross-compile stlink/libusb with some modifications to the stlink CMake instructions to statically link libraries (modifications can be seen here) with no luck: output1.txt · GitHub (command output)

Has anyone had a successful experience compiling libusb as a dependency and using it in Nerves firmware either through Buildroot or some other cross-compilation toolchain? Further, are there any recommended resources to follow for including packages like stlink/libusb in my customized Nerve system?

Thank you,