Unable to install Device::BCM2835

1,320 views
Skip to first unread message

Tom S

unread,
Dec 18, 2012, 8:01:47 AM12/18/12
to bcm...@googlegroups.com
Hi Mike,
I'm having trouble installing the Perl module. I've tried using cpanm with the command

sudo cpanm Device::BCM2835

but it fails. Here is the output from build.log:

cpanm (App::cpanminus) 1.5018 on perl 5.014002 built for arm-linux-gnueabihf-thread-multi-64int
Work directory is /root/.cpanm/work/1355833749.2677
You have make /usr/bin/make
You have /usr/bin/wget
You have /bin/tar: tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching Device::BCM2835 on cpanmetadb ...
--> Working on Device::BCM2835
Fetching http://www.cpan.org/authors/id/M/MI/MIKEM/Device-BCM2835-1.3.tar.gz
-> OK
Unpacking Device-BCM2835-1.3.tar.gz
Entering Device-BCM2835-1.3
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.57_05)
Configuring Device-BCM2835-1.3
Running Makefile.PL
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -lbcm2835
Writing Makefile for Device::BCM2835
Writing MYMETA.yml
-> OK
Checking dependencies from MYMETA.yml ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.57_05)
Building and testing Device-BCM2835-1.3
cp lib/Device/BCM2835.pm blib/lib/Device/BCM2835.pm
AutoSplitting blib/lib/Device/BCM2835.pm (blib/lib/auto/Device/BCM2835)
/usr/bin/perl /usr/share/perl/5.14/ExtUtils/xsubpp  -typemap /usr/share/perl/5.14/ExtUtils/typemap -typemap typemap  BCM2835.xs > BCM2835.xsc && mv BCM2835.xsc BCM2835.c
Please specify prototyping behavior for BCM2835.xs (see perlxs manual)
gcc-4.7 -c  -I/usr/local/projects/bcm2835/src -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"1.3\" -DXS_VERSION=\"1.3\" -fPIC "-I/usr/lib/perl/5.14/CORE"   BCM2835.c
BCM2835.xs:7:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
make: *** [BCM2835.o] Error 1
-> FAIL Installing Device::BCM2835 failed. See /root/.cpanm/build.log for details.



Any help would be greatly appreciated!

Thanks,
Tom

Mike McCauley

unread,
Dec 19, 2012, 1:39:31 AM12/19/12
to bcm...@googlegroups.com
Hello,

looks like you do not have the prerequisite bcm2835 C library installed.

Cheers.

Tom S

unread,
Dec 22, 2012, 2:53:42 PM12/22/12
to bcm...@googlegroups.com
Well, what do you know...it's right there in black & white on the CPAN page: "Building this module requires the bcm2835 library to be installed." Shoulda looked at that a little more closely. Guess I was too excited about making my LED light up. ;)

It still failed when using cpanm, but I was able to install it manually so I'm happy. Sort of. I can't get my LED to light up. It's not the code - that ran with no errors. I'm beginning to think I may have a hardware problem with my RPi. *Sigh*

Here's the output from the cpanm attempt in case you want to see it:


cpanm (App::cpanminus) 1.5018 on perl 5.014002 built for arm-linux-gnueabihf-thread-multi-64int
Work directory is /root/.cpanm/work/1356137344.5706

You have make /usr/bin/make
You have /usr/bin/wget
You have /bin/tar: tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching Device::BCM2835 on cpanmetadb ...
--> Working on Device::BCM2835
Fetching http://www.cpan.org/authors/id/M/MI/MIKEM/Device-BCM2835-1.3.tar.gz
-> OK
Unpacking Device-BCM2835-1.3.tar.gz
Entering Device-BCM2835-1.3
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.57_05)
Configuring Device-BCM2835-1.3
Running Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Device::BCM2835
Writing MYMETA.yml
-> OK
Checking dependencies from MYMETA.yml ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.57_05)
Building and testing Device-BCM2835-1.3
cp lib/Device/BCM2835.pm blib/lib/Device/BCM2835.pm
AutoSplitting blib/lib/Device/BCM2835.pm (blib/lib/auto/Device/BCM2835)
/usr/bin/perl /usr/share/perl/5.14/ExtUtils/xsubpp  -typemap /usr/share/perl/5.14/ExtUtils/typemap -typemap typemap  BCM2835.xs > BCM2835.xsc && mv BCM2835.xsc BCM2835.c
Please specify prototyping behavior for BCM2835.xs (see perlxs manual)
gcc-4.7 -c  -I/usr/local/projects/bcm2835/src -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"1.3\" -DXS_VERSION=\"1.3\" -fPIC "-I/usr/lib/perl/5.14/CORE"   BCM2835.c
Running Mkbootstrap for Device::BCM2835 ()
chmod 644 BCM2835.bs
rm -f blib/arch/auto/Device/BCM2835/BCM2835.so
gcc-4.7  -shared -L/usr/local/lib -fstack-protector BCM2835.o  -o blib/arch/auto/Device/BCM2835/BCM2835.so     \
       -lbcm2835      \
     
chmod 755 blib/arch/auto/Device/BCM2835/BCM2835.so
cp BCM2835.bs blib/arch/auto/Device/BCM2835/BCM2835.bs
chmod 644 blib/arch/auto/Device/BCM2835/BCM2835.bs
Manifying blib/man3/Device::BCM2835.3pm
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t

#   Failed test 'use Device::BCM2835;'
#   at t/Device-BCM2835.t line 12.
#     Tried to use 'Device::BCM2835'.
#     Error:  Can't load '/root/.cpanm/work/1356137344.5706/Device-BCM2835-1.3/blib/arch/auto/Device/BCM2835/BCM2835.so' for module Device::BCM2835: /root/.cpanm/work/1356137344.5706/Device-BCM2835-1.3/blib/arch/auto/Device/BCM2835/BCM2835.so: undefined symbol: clock_gettime at /usr/lib/perl/5.14/DynaLoader.pm line 184.
#  at (eval 4) line 2
# Compilation failed in require at (eval 4) line 2.
# BEGIN failed--compilation aborted at (eval 4) line 2.

#   Failed test 'Constants'
#   at t/Device-BCM2835.t line 59.
&Device::BCM2835::constant not defined at t/Device-BCM2835.t line 70
# Looks like you planned 5 tests but ran 2.
# Looks like you failed 2 tests of 2 run.
# Looks like your test exited with 255 just after 2.
t/Device-BCM2835.t ..
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/5 subtests

Test Summary Report
-------------------
t/Device-BCM2835.t (Wstat: 65280 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 5 tests but ran 2.
Files=1, Tests=2,  1 wallclock secs ( 0.57 usr  0.09 sys +  0.67 cusr  0.09 csys =  1.42 CPU)
Result: FAIL
Failed 1/1 test programs. 2/2 subtests failed.
make: *** [test_dynamic] Error 255

-> FAIL Installing Device::BCM2835 failed. See /root/.cpanm/build.log for details.



Thanks Mike!

Tom

Mike McCauley

unread,
Dec 22, 2012, 3:41:43 PM12/22/12
to bcm...@googlegroups.com
Hi,


On Saturday, December 22, 2012 11:53:42 AM Tom S wrote:
> Well, what do you know...it's right there in black & white on the CPAN
> page: "Building this module requires the bcm2835 library to be installed."
> Shoulda looked at that a little more closely. Guess I was too excited about
> making my LED light up. ;)
>
> It still failed when using cpanm, but I was able to install it manually so
> I'm happy. Sort of. I can't get my LED to light up. It's not the code -
> that ran with no errors. I'm beginning to think I may have a hardware
> problem with my RPi. *Sigh*

Just make sure that the pin you think should be blinking is the right one.
There is an implicit mapping between the BCM GPIO pin number and RPi pin
number. For example RPi Plug P1 pin 11 is GPIO pin 17.

The bcm2835 library takes GPIO pin numbers as parameters.

Cheers.
--
Mike McCauley mi...@open.com.au
Open System Consultants Pty. Ltd
9 Bulbul Place Currumbin Waters QLD 4223 Australia http://www.open.com.au
Phone +61 7 5598-7474 Fax +61 7 5598-7070

Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS,
TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS, NetWare etc.

Tom S

unread,
Dec 22, 2012, 4:10:56 PM12/22/12
to bcm...@googlegroups.com

I'm using the Adafruit Pi Cobbler (I bought the whole RPi kit from them) and I have the LED connected (in series with a 330 ohm resistor) between ground and SCLK which, if I'm looking at the right chart, should be GPIO11. But I also went through the Adafruit tutorial on the email notifier ( http://learn.adafruit.com/raspberry-pi-e-mail-notifier-using-leds/python-script ) which uses GPIO18 and GPIO23 and  got nothing. I tried stripping out the "email" portion of the code so all I had left was stuff for the GPIO and still nothing. Neither of the LEDS lit up. Setting a pin to 1 (true) does give you a logic high (ie. 3.3V), doesn't it? If it's actually sinking current I'll have to bring the LED to +V, but Adafruit has it set up for sourcing.

Thanks!

Mike McCauley

unread,
Dec 22, 2012, 4:27:36 PM12/22/12
to bcm...@googlegroups.com
Hello,

Have you checked with a logic probe or similar whether the pin is changing
state?
Is it possible that 330ohms is too high for 3.3V and your LED?
Can your device source the current needed for your LED?
You should try to elimiate whether this is a soft3ware or an electrical
problem.

And Yes: output set to 1 is logic high, as you suggest.

Cheers.

Tom S

unread,
Dec 24, 2012, 11:00:22 AM12/24/12
to bcm...@googlegroups.com
OK, I've tried a few different things. First, I checked the LED/resistor combo by going directly to 3.3V on the RPi and it worked fine. I used a Fluke 289 true RMS meter to check the actual voltage to ground on GPIO11. I checked it directly on the pins on the RPi to eliminate the possibility of a bad ribbon cable, breadboard, or Pi Cobbler breakout board. I've tried using perl & python to set the pin on and off. It ranged from .91 to 1.05V. And I duplicated these tests on a second, brand new RPi with the same results. I'm wondering now if maybe there isn't a config file somewhere that enables/disables the GPIOs? Both RPi's are running the latest version of Debian Wheezy, but I installed the OS's on both of them using BootBerry because Win32DiskImager wasn't playing nice on my Windows machine. Do you think it's possible that by using BootBerry a bit got flipped somewhere that disabled GPIO access? I realize that this problem has now gone beyond the bounds of this forum so if you want I'll take it over to the raspberrypi.org forum.

Thanks so much for all of your help!

Joe K

unread,
Jan 5, 2013, 3:23:47 PM1/5/13
to bcm...@googlegroups.com
I got the exact same error when installing via cpanm - how did you install it manually?

Mike McCauley

unread,
Jan 5, 2013, 5:23:39 PM1/5/13
to bcm...@googlegroups.com, Joe K
Hi All,

I have now uploaded a new version 1.4 that should fix this problem. When it has
been mirrored to all of CPAN, try agin.

Cheers.
> > e/BCM2835/BCM2835.so' for module Device::BCM2835:
> > /root/.cpanm/work/1356137344.5706/Device-BCM2835-1.3/blib/arch/auto/Device
Reply all
Reply to author
Forward
0 new messages