Linux 如何使 libusb 库对另一个程序可见?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10157898/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make libusb library visible to another program?
提问by LA_
I am trying to compile hidapilibrary. In order to compile that, I need libusb-1.0. I've downloaded that, configured, made and installed to /usr/local/lib
. But when I try to compile hidapi
, it doesn't see libusb-1.0
:
我正在尝试编译hidapi库。为了编译它,我需要libusb-1.0。我已经下载、配置、制作并安装到/usr/local/lib
. 但是当我尝试编译时hidapi
,它没有看到libusb-1.0
:
cc -Wall -g -c -I../hidapi
pkg-config libusb-1.0 --cflags
hid-libusb.c -o hid-libusb.o -L/usr/local/lib Package libusb-1.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `libusb-1.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libusb-1.0' found /bin/sh: cc: not found make: *[hid-libusb.o] Error 127
cc -Wall -g -c -I../hidapi
pkg-config libusb-1.0 --cflags
hid-libusb.c -o hid-libusb.o -L/usr/local/lib 在 pkg-config 搜索路径中找不到包 libusb-1.0。也许您应该将包含“libusb-1.0.pc”的目录添加到 PKG_CONFIG_PATH 环境变量中 No package 'libusb-1.0' found /bin/sh: cc: not found make: *[hid-libusb.o] Error 127
How can I fix that?
我该如何解决?
(compilation happens on Synology NAS)
(编译在 Synology NAS 上进行)
采纳答案by je4d
Since you installed to /usr/local/lib
, pkg-config
will not find your installation unless you set PKG_CONFIG_PATH
appropriately
由于您安装到/usr/local/lib
,pkg-config
除非您PKG_CONFIG_PATH
适当设置,否则将找不到您的安装
Try running:
尝试运行:
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
in your shell and then re-attempting to build your code
在你的 shell 中,然后重新尝试构建你的代码