如何使libusb库对另一个程序可见? [英] How to make libusb library visible to another program?

查看:346
本文介绍了如何使libusb库对另一个程序可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译 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包libusb-1.0是
在pkg-config搜索路径中找不到。也许你应该将包含`libusb-1.0.pc'的
目录添加到PKG_CONFIG_PATH
环境变量中找不到包'libusb-1.0'/ bin / sh:cc:not
make:

[hid-libusb.o]错误127




(在Synology NAS上进行编译)

解决方案

$ c> / usr / local / lib , pkg-config 将找不到您的安装,除非您设置 PKG_CONFIG_PATH 正确



尝试执行:

  export PKG_CONFIG_PATH =$ PKG_CONFIG_PATH:/ usr / local / lib / pkgconfig

尝试构建您的代码


I am trying to compile hidapi library. 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:

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

How can I fix that?

(compilation happens on Synology NAS)

解决方案

Since you installed to /usr/local/lib, pkg-config will not find your installation unless you set PKG_CONFIG_PATH appropriately

Try running:

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"

in your shell and then re-attempting to build your code

这篇关于如何使libusb库对另一个程序可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆