使用的sdk是ti-processor-sdk-linux-am57xx-evm-04.02.00.09-Linux-x86-Install.bin
写了个简单的使用libusb测试代码,
在编译前source环境
source environment-setup
然后直接
arm-linux-gnueabihf-gcc test.c -o test
但是但是链接是失败
/tmp/ccNCssiQ.o: In function `main':
test.c:(.text+0x14): undefined reference to `libusb_init'
collect2: error: ld returned 1 exit status
在sysroots目录下是可以查找到libusb库的
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-0.1-4.list
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-0.1-4.control
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-1.0-0.list
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-1.0-0.postinst
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-1.0-dev.list
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-1.0-dev.control
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-0.1-dev.control
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-0.1-dev.list
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-0.1-4.postinst
./armv7ahf-neon-linux-gnueabi/var/lib/opkg/info/libusb-1.0-0.control
./armv7ahf-neon-linux-gnueabi/usr/bin/libusb-config
./armv7ahf-neon-linux-gnueabi/usr/include/libusb-1.0
./armv7ahf-neon-linux-gnueabi/usr/include/libusb-1.0/libusb.h
./armv7ahf-neon-linux-gnueabi/usr/lib/pkgconfig/libusb.pc
./armv7ahf-neon-linux-gnueabi/usr/lib/pkgconfig/libusb-1.0.pc
./armv7ahf-neon-linux-gnueabi/lib/libusb-0.1.so.4.4.4
./armv7ahf-neon-linux-gnueabi/lib/libusb-1.0.so.0.1.0
./armv7ahf-neon-linux-gnueabi/lib/libusb-1.0.so.0
./armv7ahf-neon-linux-gnueabi/lib/libusb-1.0.so
./armv7ahf-neon-linux-gnueabi/lib/libusb.so
./armv7ahf-neon-linux-gnueabi/lib/libusb-0.1.so.4
如何解决这个问题?
Shine:
试试在编译命令里用-l来指定usblib库,如-lusb
yao luo:
回复 Shine:
大神,请教一个问题,usb有四个类型的端点,批量、中断、控制、同步(实时)端点,为什么Libusb库只有三种类型的传输函数?没有实时端点传输函数???
yongqing wang:
回复 yao luo:
用的哪个软件版本?