Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Device::USB and core dumped

by Arien0611 (Novice)
on Oct 16, 2012 at 15:19 UTC ( #999352=perlquestion: print w/replies, xml ) Need Help??
Arien0611 has asked for the wisdom of the Perl Monks concerning the following question:

hi guys. after some trouble, i ve managed to install through cpan the Device::USB module. However, i ve come up with a problem that google couldnt help me with. My code is this:
#!/usr/bin/perl use warnings; use diagnostics; use Device::USB; $usb = Device::USB->new(); print "1\n";
and the outcome is this:
Segmentation fault (core dumped)
my perl -d:Trace give me this:
>> (eval 7)[/usr/local/share/perl5/]:4: $INIT++; >> (eval 7)[/usr/local/share/perl5/]:5: &init; >> /usr/local/share/perl5/ local ($/, $") = ("\n", ' + '); local ($\, $,); >> /usr/local/share/perl5/ local ($/, $") = ("\n", ' + '); local ($\, $,); >> /usr/local/share/perl5/ while (my $o = shift(@DAT +A_OBJS)) { >> $usb = Device::USB->new(); >> /root/perl5/lib/perl5/i386-linux-thread-multi/Device/ + my $class = shift; >> /root/perl5/lib/perl5/i386-linux-thread-multi/Device/ + $init_ref->(); >> /root/perl5/lib/perl5/i386-linux-thread-multi/Device/ + libusb_init();
i honestly don't know what's wrong, i can't figure it out, i don't have the slightest clue. libusb1.0 and devel are installed and when the program misses the line:
$usb = Device::USB->new();
gives "1" as an outcome. Any help would be appreciated. Or some guide that could give me some guidance...

Replies are listed 'Best First'.
Re: Device::USB and core dumped
by daxim (Chaplain) on Oct 16, 2012 at 15:32 UTC
      and how do we read usb devices in perl?
Re: Device::USB and core dumped
by McA (Priest) on Oct 16, 2012 at 15:34 UTC


    my alarm bells ring when I here that you installed Device::USB with troubles knowing (after reading the man page) that this is a wrapper around a C library.

    I would assume that there is something wrong with library version (32bit/64bit) and library references.

    Check if there are more than one libusb on your system.

    Second: Let the shell write core files and dig into it with gdb. If you're lucky you get a hint.

    Update: Look at That seems to be your problem.

    Best regards

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://999352]
Approved by Corion
[Lady_Aleena]: Discipulus, do glob recurse?
[Lady_Aleena]: s/do/does/;
LanX wants to be fired
[Discipulus]: i fear no
[Discipulus]: i invented also 'gired'
[Lady_Aleena]: Discipulus, then that is a problem. I wanted to find total seconds of my entire .mp3 collection to do some math on it to see how many days of continuous music i have.
[LanX]: darn. .. I wanted to see Marine and Melonchon go to next round, just for fun xD
[Discipulus]: LA use Perl: traversing a dir tree is simple; foreach file mp3 $sec+= use Mp3::Info
[Lady_Aleena]: Discipulus, I was able to get the sum of the seconds on the command line using awk. Then I ran the result through a perl script and got the result. It came bach with 4 days, 9 hours, 56 minutes, 43 seconds.

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-04-23 20:28 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.