[Nut-upsuser] libusb not recognized?

Andrew Min Chang laplacezhang at 126.com
Sun Nov 20 01:17:25 UTC 2011


Hi Frédéric,But I do connect my ups with USB. If I do not use the --with-usb, how do I configure this option?
And in the future I might add other --with-* options, are they also proplems?




Best Regards
Andrew
2011-11-20

在 2011-11-18 19:06:55,"Frédéric Bohé" <fredericbohe at eaton.com> 写道:
>On Fri, 2011-11-18 at 18:04 +0800, Andrew Min Chang wrote:
>> 
>> Hi, Frédéric
>> 
>> 
>> 
>> 
>> At 2011-11-18 17:20:56,"Frédéric Bohé" <fredericbohe at eaton.com> wrote:
>> >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. 
>> 
>> I worried about the same thing as you do. However I do not know how to write a Makefile to sources with some package link such as testlibusb.
>> 
>>  >> >> 
>> >> >> 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[3]: *** [nut-scanner] Error 1
>> >> make[2]: *** [all] Error 2
>> >> make[1]: *** [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.
>> 
>> The whole terminal output are make.log + several error messages above. I am curious that it did not put those messages into the file I assigned.
>
>You have to redirect stderr too. This is done like this: "make >
>make.log 2>&1"
>
>Anyway, if I remember correctly, the official NUT archive have some
>trouble with "--with-*" directives when it comes to compile nut-scanner.
>This has been fixed in the svn trunk.
>So you can try to make it compile without the "--with-usb" or try the
>svn source code.
>
>
>> 
>>  >
>> >
>> >> 
>> >>  >
>> >> >> 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
>> >> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
>> >
>> >-- 
>> >Team Open Source Eaton - http://powerquality.eaton.com
>> >
>> >--------------------------------------------------------------------------
>> 
>> 
>
>-- 
>Team Open Source Eaton - http://powerquality.eaton.com
>
>--------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20111120/3bc5db4b/attachment-0001.html>


More information about the Nut-upsuser mailing list