0
filip@filip-pc:~/Desktop/hidTest$ cargo build
   Compiling pkg-config v0.3.17
   Compiling libc v0.2.71
   Compiling cc v1.0.54
   Compiling hidapi v1.2.2
error: failed to run custom build command for `hidapi v1.2.2`

Caused by:
  process didn't exit successfully: `/home/filip/Desktop/hidTest/target/debug/build/hidapi-f1cb7b18f844a4a0/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to find libusb-1.0: "`\"pkg-config\" \"--libs\" \"--cflags\" \"libusb-1.0\"` did not exit successfully: exit code: 1\n--- stderr\nPackage libusb-1.0 was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libusb-1.0.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'libusb-1.0\' found\n"', /home/filip/.cargo/registry/src/github.com-1ecc6299db9ec823/hidapi-1.2.2/build.rs:65:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

我只是尝试从文档https://docs.rs/hidapi/1.2.2/hidapi/运行示例

有人遇到这个错误吗?

我已经尝试了

货物清洁

货物建造

再次

4

1 回答 1

1

您必须在系统上安装 libusb-1.0。您似乎正在使用 Homebrew,因此您还必须通过 Homebrew 专门安装它,因为这是 pkg-config 正在寻找它的地方。

Homebrew 可能没有以这个确切的名称提供这个库,或者这个hidapicrate 与 macOS 不兼容。检查hidapicrate 以获取详细信息,因为它是 crate 特定的问题。

于 2020-06-10T20:55:55.960 回答