Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Device::USB gives "Use of uninitialized value in concatenation" error

by holandes777 (Scribe)
on Dec 10, 2013 at 23:11 UTC ( [id://1066520]=perlquestion: print w/replies, xml ) Need Help??

holandes777 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks:

This is the shortest Perl program I have ever posted to as for advice on:

use Device::USB;

That's it!

The error is repeated 3 times and says:

 Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/Device/USB.pm line 10.

Line 9,10,11 of the referenced module say:

9 use Inline ( 10 C => "DATA", 11 ($ENV{LIBUSB_LIBDIR}

I am using Kubuntu desktop 13.10 and I confess I may have screwed up by doing a "cpan install Device::USB". That did not do a complete install. I had forgotten that it should be apt-get install libdevice-usb-perl. I did that and some earlier errors went away, but not this one. So I did and cpan uninstall Device::USB. That did not complete well. I also did an apt-get install libusb-1.0.0, which went well and an apt-get install libusb-1.0.0-dev which told me everything was up to date

I thought it might be that the Inline module is required but not installed. I did a three line program:

use strict; use warnings; use Inline;

and there were no complaints so I have to assume that is not the problem

Your advice is, as always, appreciated, Best regards

Replies are listed 'Best First'.
Re: Device::USB gives "Use of uninitialized value in concatenation" error
by thezip (Vicar) on Dec 10, 2013 at 23:39 UTC

    Perhaps you could preset the operating system "LIBUSB_LIBDIR" environment variable to something in a wrapper script?


    *My* tenacity goes to eleven...
Re: Device::USB gives "Use of uninitialized value in concatenation" error
by Anonymous Monk on Dec 10, 2013 at 23:34 UTC

    What do you think the "error" means?

    Did you add "use diagnostics;" to get a more verbose "error" message?

    Do you have defined $ENV{LIBUSB_LIBDIR} ? Try getting rid of that (not defining it)

      I think the error means the module is trying to perform a concatenation and one of the variables it is attempting to use is undefined. This is definitely the case with $ENV{LIBUSB_LIBDIR}, it is undefined.

      Device::USB is a cpan module, rather than trying to get rid of the variable I think I should ascertain what its value should be

      root@gk-kubuntu-dev:~/dav/Nevada# find / -name libusb* /lib/firmware/carl9170fw/extra/libusb-zeropacket.diff /lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4 /lib/x86_64-linux-gnu/libusb-0.1.so.4 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0 /lib/x86_64-linux-gnu/libusb-1.0.so.0 /var/cache/apt/archives/libusb-1.0-0-dbg_2%3a1.0.16-3_amd64.deb /var/cache/apt/archives/libusb-1.0-0-dev_2%3a1.0.16-3_amd64.deb /var/cache/apt/archives/libusb-1.0-doc_2%3a1.0.16-3_all.deb /var/lib/dpkg/info/libusb-0.1-4:amd64.shlibs /var/lib/dpkg/info/libusb-1.0-0-dbg:amd64.list /var/lib/dpkg/info/libusb-1.0-0:amd64.md5sums /var/lib/dpkg/info/libusb-0.1-4:amd64.symbols /var/lib/dpkg/info/libusb-1.0-0:amd64.postrm /var/lib/dpkg/info/libusbmuxd2.symbols /var/lib/dpkg/info/libusb-0.1-4:amd64.postrm /var/lib/dpkg/info/libusb-1.0-0:amd64.postinst /var/lib/dpkg/info/libusbmuxd2.postinst /var/lib/dpkg/info/libusb-1.0-0:amd64.shlibs /var/lib/dpkg/info/libusb-0.1-4:amd64.postinst /var/lib/dpkg/info/libusbmuxd2.md5sums /var/lib/dpkg/info/libusb-1.0-doc.list /var/lib/dpkg/info/libusbmuxd2.postrm /var/lib/dpkg/info/libusb-1.0-0-dev:amd64.list /var/lib/dpkg/info/libusb-1.0-doc.md5sums /var/lib/dpkg/info/libusb-1.0-0-dev:amd64.md5sums /var/lib/dpkg/info/libusb-1.0-0:amd64.list /var/lib/dpkg/info/libusb-1.0-0:amd64.symbols /var/lib/dpkg/info/libusb-1.0-0-dbg:amd64.md5sums /var/lib/dpkg/info/libusbmuxd2.shlibs /var/lib/dpkg/info/libusb-0.1-4:amd64.list /var/lib/dpkg/info/libusbmuxd2.list /var/lib/dpkg/info/libusb-0.1-4:amd64.md5sums /usr/share/doc-base/libusb-1.0-doc /usr/share/doc/libusb-1.0-0 /usr/share/doc/libusb-1.0-0-dev /usr/share/doc/libusb-0.1-4 /usr/share/doc/libusb-1.0-doc /usr/share/doc/libusb-1.0-doc/html/libusb_8h_source.html /usr/share/doc/libusb-1.0-0-dbg /usr/share/doc/libusbmuxd2 /usr/lib/libusbmuxd.so.1.0.8 /usr/lib/libusbmuxd.so.2 /usr/lib/x86_64-linux-gnu/libusb-1.0.so /usr/lib/x86_64-linux-gnu/libusb-1.0.a /usr/lib/x86_64-linux-gnu/pkgconfig/libusb-1.0.pc /usr/lib/debug/lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0 /usr/include/libusb-1.0 /usr/include/libusb-1.0/libusb.h

      I chose /lib/x86_64-linux-gnu/ and /usr/include/ and assigned the values to $ENV{LIBUSB_LIBDIR}, neither of which worked.

      Is it possible that there a missing symlink someplace that should point to libusb(somethingorother)? The code from USB.pm is as follows:

      9 use Inline ( 10 C => "DATA", 11 ($ENV{LIBUSB_LIBDIR} 12 ? ( LIBS => "-L\"$ENV{LIBUSB_LIBDIR}\" " . 13 ($^O eq 'MSWin32' ? ' -llibusb -L\"$ENV{W +INDDK}\\lib\\crt\\i386\" -lmsvcrt ' : '-lusb') ) 14 : ( LIBS => '-lusb', ) 15 ), 16 ($ENV{LIBUSB_INCDIR} ? ( INC => "-I\"$ENV{LIBUSB_INCDIR}\ +"" ) : () ), 17 NAME => 'Device::USB', 18 VERSION => '0.35', 19 CCFLAGS => "$Config{ccflags} $ENV{CFLAGS} $ENV{CPPFLAGS}" +, 20 LDDLFLAGS => "$Config{lddlflags} $ENV{LDFLAGS}", 21 ); 22 23 Inline->init();

      I don't recognize what it is. Is it bash code to set up the environment? This is fascinating: I commented out lines 11,12,13,14,15 and the error persists. What is most interesting is that in that section the only concatenation operator is on line 12, and even commented out the error persists. This indicates the error is elsewhere, bu there are no further concatenations in the USB.pm file.

        My guess would be that it's complaining about undefined CFLAGS / CPPFLAGS / LDFLAGS environment variables (see line 19 and 20). Line numbers reported are not always precise when a statement stretches over multiple lines.

        Try setting those env variables to nothing, i.e. export CFLAGS= etc., and see what happens...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1066520]
Approved by Eliya
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2024-04-25 00:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found