无法构建 hidapi rust 示例
Can't build hidapi rust example
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/
有人遇到过这个错误吗?
我已经试过了
cargo clean
和
cargo build
再次
您必须在您的系统上安装 libusb-1.0。您似乎正在使用 Homebrew,因此您还必须通过 Homebrew 专门安装它,因为 pkg-config 正在寻找它。
有可能 Homebrew 没有以这个确切的名称提供这个库,或者 hidapi
crate 与 macOS 不兼容。检查 hidapi
crate 了解详情,因为它是特定于 crate 的问题。
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/
有人遇到过这个错误吗?
我已经试过了
cargo clean
和
cargo build
再次
您必须在您的系统上安装 libusb-1.0。您似乎正在使用 Homebrew,因此您还必须通过 Homebrew 专门安装它,因为 pkg-config 正在寻找它。
有可能 Homebrew 没有以这个确切的名称提供这个库,或者 hidapi
crate 与 macOS 不兼容。检查 hidapi
crate 了解详情,因为它是特定于 crate 的问题。