赞
踩
libusb 下载地址: https://sourceforge.net/projects/libusb/
usbutils 下载地址:https://mirrors.edge.kernel.org/pub/linux/utils/usb/usbutils/
我使用的是 libusb-1.0.22 和 usbutils-005
libusb 交叉编译:
./configure CC={编译器目录}/mipsel-linux-gcc --build=i686-linux --host=mipsel-linux --prefix={安装目录} --disable-udev && make && make install
usbutils 交叉编译:
./configure CC={编译器目录}/mipsel-linux-gcc --build=i686-linux --host=mipsel-linux --prefix={安装目录} --datarootdir=/tmp
执行以上 configure 会报错如下,找不到 libusb 的 pkg-config,此时需要指定 PKG_CONFIG_PATH={libusb所在目录}
- configure: error: Package requirements (libusb-1.0 >= 1.0.0) were not met:
-
- 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
- Consider adjusting the PKG_CONFIG_PATH environment variable if you
- installed software in a non-standard prefix.
- Alternatively, you may set the environment variables LIBUSB_CFLAGS
- and LIBUSB_LIBS to avoid the need to call pkg-config.
- See the pkg-config man page for more details.
再次 configure 会报错如下,需要更改 usbhid-dump/configure,指定 libusb-1.0.so 所在目录
- checking how to hardcode library paths into programs... immediate
- checking whether stripping libraries is possible... yes
- checking if libtool supports shared libraries... yes
- checking whether to build shared libraries... yes
- checking whether to build static libraries... yes
- checking for libusb_init in -lusb-1.0... no
- configure: error: in `/home/chengc/otherGround/software/usbutils-005/usbhid-dump':
- configure: error: libusb is required, but was not found, abort.
- Try installing libusb-1.0-0-dev or libusb1-devel.
- See `config.log' for more details
- configure: error: ./configure failed for usbhid-dump
再次 configure,结果如下:
- config.status: config.h is unchanged
- config.status: executing depfiles commands
- config.status: executing libtool commands
-
- usbutils 005
- =============
-
- prefix: /home/**************
- datarootdir: /tmp
- datadir: ${datarootdir}
- mandir: ${datarootdir}/man
-
- usb.ids: ${datarootdir}/usb.ids
- zlib:
-
- compiler: /opt/trendchip/mipsel-linux-glibc-4.6.3-kernel3.18/usr/bin/mipsel-linux-gcc
- cflags: -g -O2
- ldflags:

make 时可能报错如下,将 libusb 安装目录中的 include/libusb-1.0 拷贝到 usbhid-dump/include/ 即可
usbutils-005/usbhid-dump/include/uhd/dev.h:31:31: fatal error: libusb-1.0/libusb.h: No such file or directory
最后 make && make install 即可。
lsusb 命令使用时需要 usb.ids 这个文件,这个文件在 usbutils 根目录下,将这个文件 拷贝到 编译 usbutils 时指定的 {datarootdir} 目录即可.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。