[Nut-upsuser] libusb not recognized?
fredericbohe at eaton.com
Fri Nov 18 09:20:56 UTC 2011
On Fri, 2011-11-18 at 10:35 +0800, Andrew Min Chang wrote:
> Hi Charles,
> At 2011-11-17 21:07:52,"Charles Lepple" <clepple at gmail.com> wrote:
> >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'".
> OK. I tried commands below:
> # export PKG_CONFIG_PATH=/mnt/ARM_FS/lib/pkgconfig
> > ./configure --with-usb --with-doc \
> > --host=arm-mv5sft-linux-gnueabi \
> > --prefix=/mnt/ARM_FS
> And I got the message "Asciidoc is required for documentation support and missing". This was not a important point, so I removed "--with-doc" and tried again. Then it worked!
> But there came another problem. I ran:
> # make > make.log
> And I got another error:
> /root/uboot_NAS/cross/bin/../lib/gcc/arm-mv5sft-linux-gnueabi/4.3.2/../../../../arm-mv5sft-linux-gnueabi/bin/ld: warning: libupsclient.so.1, needed by ./.libs/libnutscan.so, not found (try using -rpath or -rpath-link)
> ./.libs/libnutscan.so: undefined re
> ference to `upscli_splitaddr'
> ./.libs/libnutscan.so: undefined reference to `upscli_list_start'
> ./.libs/libnutscan.so: undefined reference to `upscli_list_next'
> ./.libs/libnutscan.so: undefined reference to `upscli_tryconnect'
> collect2: ld returned 1 exit status
> make: *** [nut-scanner] Error 1
> make: *** [all] Error 2
> make: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> Uh... why does it search something like libups in cross compile tool?
> The two log files are attached.
Maybe I missed something but I can't see the warning you are reporting
in the attached make.log.
> >> 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.
> So, just use libusb-0.1.12 without libusb-compat is OK. Right? Now I use v0.1.12.
> Nut-upsuser mailing list
> Nut-upsuser at lists.alioth.debian.org
Team Open Source Eaton - http://powerquality.eaton.com
More information about the Nut-upsuser