ruabmbua / hidapi-rs

Rust bindings for the hidapi C library
MIT License
165 stars 79 forks source link

Cross and hidapi #121

Open axoulc opened 1 year ago

axoulc commented 1 year ago

Hi everyone, I need your help. I need to compile my project for raspberry zero w (arm-unknown-linux-gnueabihf) with cross-rs.

One of my dependencies is hidapi.

And I can't compile it because of this error :

running: "arm-unknown-linux-gnueabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-march=armv6" "-marm" "-mfpu=vfp" "-I" "etc/hidapi/hidapi" "-Wall" "-Wextra" "-o" "/target/arm-unknown-linux-gnueabihf/debug/build/hidapi-1db7329408b595f5/out/etc/hidapi/linux/hid.o" "-c" "etc/hidapi/linux/hid.c"
  cargo:warning=etc/hidapi/linux/hid.c:43:10: fatal error: libudev.h: No such file or directory
  cargo:warning= #include \<libudev.h>
  cargo:warning=          ^~~~~~~~~~~
  cargo:warning=compilation terminated.
  exit status: 1

  --- stderr

I even tried to build it with a custom Dockerfile, but with the same issue.

My Cross.toml :

[target.arm-unknown-linux-gnueabihf]
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update && apt-get install --assume-yes libusb-1.0-0-dev:amd64 libudev-dev:amd64 libhidapi-dev:amd64 libusb-1.0-0-dev:$CROSS_DEB_ARCH libudev-dev:$CROSS_DEB_ARCH libhidapi-dev:$CROSS_DEB_ARCH"
]

Thanks in advance if anyone could help me !