[Nut-upsuser] libusb not recognized?
Charles Lepple
clepple at gmail.com
Thu Nov 17 13:07:52 UTC 2011
On Nov 16, 2011, at 8:10 PM, Andrew Min Chang wrote:
> Oh, you gave me inspiration. The Difference between my NUT and testlibusb is: NUT is compiled with cross enviroment, while testlibusb was builded directly on the target board. I wonder if that made different.
>
> But still, NUT could not be configured even though testlibusb.c ran. Maybe my commands wrong?
> # export PKG_CONFIG_PATH=/mnt/ARM_FS/lib/pkgconfig
> # ./configure --with-usb --with-doc \
> --host=arm-mv5sft-linux-gnueabi \
> --prefix=/mnt/ARM_FS \
> --with-usb-libs=-L/mnt/ARM_FS/lib \
> --with-usb-includes=-I/mnt/ARM_FS/include
>
> Accoding config.log, actually I found that libusb 0.1.12 was recognized (config.log attached).
If you have pkgconfig set up properly for the board, you should not need to pass --with-usb-*.
Here's the output from config.log:
configure:7259: checking for libusb version via pkg-config
configure:7278: result: 0.1.12 found
configure:7281: checking for libusb cflags
configure:7298: result: -I/mnt/ARM_FS/include
configure:7301: checking for libusb ldflags
configure:7318: result: -L/mnt/ARM_FS/lib
configure:7323: checking for usb.h
configure:7323: arm-mv5sft-linux-gnueabi-gcc -c -I/mnt/ARM_FS/include conftest.c >&5
configure:7323: $? = 0
configure:7323: result: yes
configure:7338: checking for usb_init
configure:7338: arm-mv5sft-linux-gnueabi-gcc -o conftest -I/mnt/ARM_FS/include conftest.c -L/mnt/ARM_FS/lib >&5
/tmp/ccbkkKUg.o: In function `main':
conftest.c:(.text+0x8): undefined reference to `usb_init'
collect2: ld returned 1 exit status
Note the command line next to "configure:7338". It does not mention "-lusb", which refers to the libusb library itself. The "-L..." option simply tells the linker "search this directory for libraries specified with -l", but you still need to request that library.
Try it without the --with-usb flags. If that still doesn't work, you may need to do something like "--with-usb-libs='-L/mnt/ARM_FS/lib -lusb'".
> About libusb-compat, isn't that a interface to make programs compatible with later linusb-1.0?
> Because libusb-compat is not able to be configured when dectectting libusb-0.1, even the oldest ver 0.1.0. libusb-compat config.log is attached, too.
libusb-compat and libusb-1.0 should be equivalent to libusb-0.1.x. However, since NUT is developed with the libusb-0.1.x series, it does not make sense to have two variables (libusb-compat and libusb-1.0) when we could debug with one (libusb-0.1.x)
> You can see the error message "checking for LIBUSB_1_0... configure: error: Package requirements (libusb-1.0 >= 0.9.1) were not met".
In order to provide the libusb-0.1 API, libusb-compat depends on libusb-1.0. This is expected.
More information about the Nut-upsuser
mailing list