Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Upgrade CPAN for Perl in Raspbian Linux fails

719 views
Skip to first unread message

M.O.B. i L.

unread,
Feb 28, 2015, 9:07:27 AM2/28/15
to
I'm trying to upgrade CPAN in latest and most upgraded Raspbian. I run
this on a Raspberry Pi A with 256 MB RAM of which 32 MB is graphics
memory. Cpan doesn't complain about being out of memory, but it can't
unarchive. I have installed gcc-4.7 which seems to be required to
compile inside cpan. My goal is to install Tkx after upgrading CPAN:
http://www.tkdocs.com/tutorial/install.html . I've done this in Ubuntu
14.04 for x86-32. There is no libtkx-perl for Raspbian or Ubuntu, but
there was for earlier versions of Debian:
https://packages.debian.org/search?keywords=libtkx-perl
Now I try to install Tkx using the old CPAN, but it locks me out of the
system due to high CPU-load. When the screen-saver started I can't
interrupt it. I can't login using SSH. I can't use the Alt+F1 terminal I
run startx from since the screensaver can't be interrupted. I thought
Linux prioritized user input, but I don't think Linux works that well if
it locks out the user when the CPU-load is high -- it would be better if
it compiled Perl-modules at a lower pace and let the user issue
commands. Even if this would be due to low memory a good operating
system would handle that by sending a message about low memory and then
terminate the operation of cpan. Update: Now the installation of Tkx
seems to have hung completely and the OS can't be contacted, but the
green light for SD-card access is permanently on.

Is there anyone here that has succeeded in upgrading CPAN to 2.05. I
think Perl without a useable cpan would be rather useless.

I configured cpan to use sudo -- the same configuration works in Ubuntu.

Here is the session:

pi@pi1a ~ $ cpan
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.960001)
Enter 'h' for help.

cpan[1]> install CPAN
Fetching with HTTP::Tiny:
http://kvin.lv/pub/CPAN/authors/01mailrc.txt.gz
Going to read '/home/pi/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with HTTP::Tiny:
http://kvin.lv/pub/CPAN/modules/02packages.details.txt.gz
Going to read '/home/pi/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Fri, 27 Feb 2015 18:53:27 GMT
HTTP::Date not available
..............
New CPAN.pm version (v2.05) available.
[Currently running version is v1.960001]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.


..............................................................DONE
Fetching with HTTP::Tiny:
http://kvin.lv/pub/CPAN/modules/03modlist.data.gz
Going to read '/home/pi/.cpan/sources/modules/03modlist.data.gz'
DONE
Going to write /home/pi/.cpan/Metadata
Running install for module 'CPAN'
Running make for A/AN/ANDK/CPAN-2.05.tar.gz
Fetching with HTTP::Tiny:
http://kvin.lv/pub/CPAN/authors/id/A/AN/ANDK/CPAN-2.05.tar.gz
Fetching with HTTP::Tiny:
http://kvin.lv/pub/CPAN/authors/id/A/AN/ANDK/CHECKSUMS
Checksum for /home/pi/.cpan/sources/authors/id/A/AN/ANDK/CPAN-2.05.tar.gz ok
Scanning cache /home/pi/.cpan/build for sizes
Use of uninitialized value $newdir in substitution (s///) at
/usr/lib/perl/5.14/Cwd.pm line 330.
Use of uninitialized value $newdir in chdir at /usr/lib/perl/5.14/Cwd.pm
line 338.
Use of chdir('') or chdir(undef) as chdir() is deprecated at
/usr/lib/perl/5.14/Cwd.pm line 338.
Use of uninitialized value $newdir in pattern match (m//) at
/usr/lib/perl/5.14/Cwd.pm line 353.
Use of uninitialized value $newdir in split at /usr/lib/perl/5.14/Cwd.pm
line 359.
DONE
Uncompressed
/home/pi/.cpan/sources/authors/id/A/AN/ANDK/CPAN-2.05.tar.gz successfully
Using Tar:/bin/tar xf "CPAN-2.05.tar":
Couldn't untar CPAN-2.05.tar
Package seems to come without Makefile.PL.
(The test -f "/home/pi/.cpan/build/ANDK-kgV6rc/Makefile.PL" returned
false.)
Writing one on our own (setting NAME to CPAN)
Had problems unarchiving. Please build manually
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Failed during this command:
ANDK/CPAN-2.05.tar.gz : unwrapped NO -- untar
failed

cpan[2]>

Ulf Volmer

unread,
Feb 28, 2015, 2:30:03 PM2/28/15
to
M.O.B. i L. <mo...@orbin.se> schrieb:

> I'm trying to upgrade CPAN in latest and most upgraded Raspbian.D I run
> this on a Raspberry Pi A with 256 MB RAM of which 32 MB is graphics
> memory. Cpan doesn't complain about being out of memory, but it can't
> unarchive. I

> Failed during this command:
> ANDK/CPAN-2.05.tar.gz : unwrapped NO -- untar
> failed

a quick google search point me to

http://stackoverflow.com/questions/9363372/cpan-perl-modules-installer-not-finding-tar-file

which suggest a memory issue. Have you tried to add more swap- space?

regards
Ulf

M.O.B. i L.

unread,
Feb 28, 2015, 6:02:39 PM2/28/15
to
Thanks, but I don't know how to add swap-space. Is it just to plug-in a
USB-stick with a swap-partition? If it is an out of RAM-memory problem I
think the error messages should be clearer.

Anyway I found a way to install Tkx usin cpanm. The installation runs
fine with windows popping up to test functions, but then the programs I
write fail with segmentation fault. I installed it in Raspbian with
these command lines:

###
sudo apt-get update && sudo apt-get install gcc-4.7 tcl8.5-dev
sudo curl -L http://cpanmin.us | perl - --sudo App::cpanminus
wget http://www.cpan.org/authors/id/V/VK/VKON/Tcl-1.02.tar.gz
tar xvf Tcl-1.02.tar.gz
cd Tcl-1.02/
perl Makefile.PL
sed -i 's|#include <tcl.h>|#include "tcl-core/include/tcl.h"|' Tcl.xs
make
sudo make install
sudo cpanm Tkx # <-- Installs successfully with windows in #
# the self-test. #
cd ..
rm -rf Tcl-1.02
perl -MTkx -e 'print Tkx::info("patchlevel");' # <-- Fails with #
# segmentation fault. #
###

I also tried some other tcl.h:s on my system, but with the same
segmentation fault.

Example Perl-program from http://www.tkdocs.com/tutorial/install.html:
use Tkx;
Tkx::grid( Tkx::ttk__button(".b", -text => "Hello, world" ) );
Tkx::MainLoop();

Run with:
perl hello.pl # Causes segmentation fault.

The Python-program and Tcl program from the same page both work in
Raspbian out-of-the-box:

python3 hello.py
wish hello.tcl

The ruby-program doesn't work with:
ruby hello.rb

Tkx works without problems and didn't need patching in Ubuntu 14.04 LTS
for x86-32, but then I installed it using most updated cpan, and not cpanm.

Martin Gregorie

unread,
Feb 28, 2015, 8:37:27 PM2/28/15
to
On Sat, 28 Feb 2015 15:07:26 +0100, M.O.B. i L. wrote:

CPAN and a linux distro's packages are not compatible because they use
entirely separate methods for resolving dependencies. Using both in the
same development system is a good way to bork your Perl set-up because
its very unlikely that CPAN and the Raspbian package management will be
in sync as regards library versions and patch levels.

In short:
- if you're going to use CPAN, start by uninstalling all the Raspbian
Perl packages and only use CPAN as your source of Perl libraries,
modules and updates.

- if you decide to stick with the Raspbian Perl package set, don't go
near CPAN.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

M.O.B. i L.

unread,
Mar 2, 2015, 6:35:28 AM3/2/15
to
I prefer to stick with Raspbian. I could find a lot of modules by
searching in aptitude for "-perl". Is there a way to list all packages
that matches /lib.*-perl/ ?

I did find a Debian-method of installing from CPAN on
https://wiki.debian.org/PerlFAQ , but it also fails on Raspberry Pi
Model A with 32 MB GPU-RAM -- probably due to too little RAM:
sudo apt-get update && sudo apt-get -y install dh-make-perl
dh-make-perl --build --cpan Tcl

Output:
Going to read '/home/pi/.cpan/Metadata'
Going to read '/home/pi/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Going to read '/home/pi/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Mon, 02 Mar 2015 07:41:02 GMT
..............
New CPAN.pm version (v2.05) available.
[Currently running version is v1.960001]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.

CPAN: Time::HiRes loaded ok (v1.972101)

..............................................................DONE
Fetching with LWP:
http://mirror.issp.co.th/cpan/modules/03modlist.data.gz
Going to read '/home/pi/.cpan/sources/modules/03modlist.data.gz'
DONE
Going to write /home/pi/.cpan/Metadata
Fetching with LWP:
http://mirror.issp.co.th/cpan/authors/id/V/VK/VKON/Tcl-1.02.tar.gz
CPAN: Digest::SHA loaded ok (v5.61)
Fetching with LWP:
http://mirror.issp.co.th/cpan/authors/id/V/VK/VKON/CHECKSUMS
Checksum for /home/pi/.cpan/sources/authors/id/V/VK/VKON/Tcl-1.02.tar.gz ok
Uncompressed /home/pi/.cpan/sources/authors/id/V/VK/VKON/Tcl-1.02.tar.gz
successfully
Using Tar:/bin/tar xvf "Tcl-1.02.tar":
Couldn't untar Tcl-1.02.tar
CPAN: File::Temp loaded ok (v0.22)
Package seems to come without Makefile.PL.
(The test -f "/home/pi/.cpan/build/VKON-zFdbaQ/Makefile.PL" returned
false.)
Writing one on our own (setting NAME to unknown)
Failed to move /home/pi/.cpan/build/VKON-zFdbaQ to /home/pi/Tcl-1.02:
Cannot allocate memory at /usr/share/perl5/DhMakePerl/Command/make.pm
line 306.

When I run this I was locked out of my system for a long time and
couldn't even interrupt the screen-saver. I think this is extremely bad
for an OS. Maybe this is a unique behavior for Raspbian on Raspberry Pi.
I think they should reserve some CPU-time for the user to at least be
able to kill the program.

Alex Potter

unread,
Mar 2, 2015, 7:02:51 AM3/2/15
to
On Mon, 02 Mar 2015 12:35:27 +0100, M.O.B. i L. wrote:

> Is there a way to list all packages that matches /lib.*-perl/ ?

Does `aptitude search lib.*perl | less` do the trick?

--
Alex

M.O.B. i L.

unread,
Mar 2, 2015, 6:45:10 PM3/2/15
to
Thanks it works!

M.O.B. i L.

unread,
Mar 2, 2015, 7:14:49 PM3/2/15
to
Now I gotten a Raspberry Pi B+ with 512 MB RAM - 32 MB GPU-RAM and can
compile but it fails using:
cpan2deb Tcl

Output:
Going to read '/home/pi/.cpan/Metadata'
Database was generated on Mon, 02 Mar 2015 07:41:02 GMT
CPAN: Digest::SHA loaded ok (v5.61)
Checksum for /home/pi/.cpan/sources/authors/id/V/VK/VKON/Tcl-1.02.tar.gz ok
Tcl-1.02/
Tcl-1.02/tcl-core/
Tcl-1.02/tcl-core/solaris-sparc/
Tcl-1.02/tcl-core/solaris-sparc/libtclstub8.4.a
Tcl-1.02/tcl-core/hpux-parisc/
Tcl-1.02/tcl-core/hpux-parisc/libtclstub8.4.a
Tcl-1.02/tcl-core/aix/
Tcl-1.02/tcl-core/aix/libtclstub8.4.a
Tcl-1.02/tcl-core/linux-x86_64/
Tcl-1.02/tcl-core/linux-x86_64/libtclstub8.4.a
Tcl-1.02/tcl-core/include/
Tcl-1.02/tcl-core/include/tcl.h
[...]
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Tcl
Writing MYMETA.yml and MYMETA.json
dh_auto_build
make[1]: Entering directory '/home/pi/Tcl-1.02'
cp Tcl.pm blib/lib/Tcl.pm
Running Mkbootstrap for Tcl ()
chmod 644 "Tcl.bs"
"/usr/bin/perl" "/usr/share/perl/5.14/ExtUtils/xsubpp" -typemap
"/usr/share/perl/5.14/ExtUtils/typemap" -typemap "typemap" Tcl.xs >
Tcl.xsc && mv Tcl.xsc Tcl.c
Please specify prototyping behavior for Tcl.xs (see perlxs manual)
cc -c -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.02\" -DXS_VERSION=\"1.02\"
-fPIC "-I/usr/lib/perl/5.14/CORE" -DUSE_TCL_STUBS
-DTCL_LIB_FILE=\"libtcl8.5.so\" Tcl.c
Tcl.xs:32:17: fatal error: tcl.h: No such file or directory
compilation terminated.

There is some group working on libtcl-perl for Debian:
https://packages.qa.debian.org/libt/libtcl-perl.html

Maybe one could get this to work in Raspbian.

I tried:
git clone git://anonscm.debian.org/pkg-perl/packages/libtcl-perl.git
cd libtcl-perl/
perl Makefile.PL
make

Output:
cp Tcl.pm blib/lib/Tcl.pm
Running Mkbootstrap for Tcl ()
chmod 644 "Tcl.bs"
"/usr/bin/perl" "/usr/share/perl/5.14/ExtUtils/xsubpp" -typemap
"/usr/share/perl/5.14/ExtUtils/typemap" -typemap "typemap" Tcl.xs >
Tcl.xsc && mv Tcl.xsc Tcl.c
Please specify prototyping behavior for Tcl.xs (see perlxs manual)
cc -c -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.02\" -DXS_VERSION=\"1.02\"
-fPIC "-I/usr/lib/perl/5.14/CORE" -DUSE_TCL_STUBS
-DTCL_LIB_FILE=\"libtcl8.5.so\" Tcl.c
Tcl.xs:32:17: fatal error: tcl.h: No such file or directory
compilation terminated.
Makefile:342: recipe for target 'Tcl.o' failed
make: *** [Tcl.o] Error 1

I do have tcl.h on my system.
find / -name tcl.h 2> /dev/null

Output:
/usr/lib/perl5/Tk/pTk/tcl.h
/usr/include/tcl8.5/tcl-private/generic/tcl.h
/usr/include/tcl8.5/tcl.h

This works:
cpan2deb Tkx

But after installation it doesn't work, and one gets segment fault when
using it, even if I have the manually installed Tcl for Perl.

gregor herrmann

unread,
Mar 6, 2015, 2:20:13 PM3/6/15
to
On Tue, 03 Mar 2015 01:14:47 +0100, M.O.B. i L. wrote:

> There is some group working on libtcl-perl for Debian:
> https://packages.qa.debian.org/libt/libtcl-perl.html
> Maybe one could get this to work in Raspbian.

libtcl-perl exists in Debian testing and unstable, and also in
Raspbian testing:

Debian:
% apt-cache policy libtcl-perl
libtcl-perl:
Installed: (none)
Candidate: 1.02+ds-2+b1
Version table:
1.02+ds-2+b1 0
500 http://ftp.ch.debian.org/debian/ testing/main amd64 Packages
990 http://ftp.ch.debian.org/debian/ unstable/main amd64 Packages


Raspbian:

% apt-cache policy libtcl-perl
libtcl-perl:
Installed: (none)
Candidate: 1.02+ds-2+b1
Version table:
1.02+ds-2+b1 0
500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages

> I tried:
> git clone git://anonscm.debian.org/pkg-perl/packages/libtcl-perl.git
> cd libtcl-perl/
> perl Makefile.PL
> make

Well, you should try to build a Debian package from the Debian source :)

> Output:
> cp Tcl.pm blib/lib/Tcl.pm
> Running Mkbootstrap for Tcl ()
> chmod 644 "Tcl.bs"
> "/usr/bin/perl" "/usr/share/perl/5.14/ExtUtils/xsubpp" -typemap
> "/usr/share/perl/5.14/ExtUtils/typemap" -typemap "typemap" Tcl.xs >
> Tcl.xsc && mv Tcl.xsc Tcl.c
> Please specify prototyping behavior for Tcl.xs (see perlxs manual)
> cc -c -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.02\" -DXS_VERSION=\"1.02\"
> -fPIC "-I/usr/lib/perl/5.14/CORE" -DUSE_TCL_STUBS
> -DTCL_LIB_FILE=\"libtcl8.5.so\" Tcl.c
> Tcl.xs:32:17: fatal error: tcl.h: No such file or directory
> compilation terminated.
> Makefile:342: recipe for target 'Tcl.o' failed
> make: *** [Tcl.o] Error 1


> I do have tcl.h on my system.
> find / -name tcl.h 2> /dev/null
>
> Output:
> /usr/lib/perl5/Tk/pTk/tcl.h
> /usr/include/tcl8.5/tcl-private/generic/tcl.h
> /usr/include/tcl8.5/tcl.h

Interesting.


Ok, looking at the debian/rules file, there is some magic involved:

#v+
% cat debian/rules
#!/usr/bin/make -f

TCLCONFIG=$(shell grep -Eo '/usr/lib/.+/tclConfig.sh' /usr/lib/tclConfig.sh)

%:
dh $@

override_dh_auto_configure:
dh_auto_configure -- --tclconfig $(TCLCONFIG) --no-usestubs
#v-

Maybe you could try to build the package the debian way; after
cloning the repo, make sure to have the Build-Depends installed [0],
and then try to run `dpkg-buildpackage -uc -us'.

Alternatively you could try to simulate the parameters from
debian/rules as
perl Makefile.PL --tclconfig $(grep -Eo '/usr/lib/.+/tclConfig.sh' /usr/lib/tclConfig.sh) --no-usestubs

(Maybe only the --no-usestubs is enough ...)

gregor


[0]
debhelper tcl tcl-dev perl

--
.''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
: :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/
`. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
`- NP: Led Zeppelin: Babe I'm Gonna Leave You

M.O.B. i L.

unread,
Mar 9, 2015, 6:05:42 AM3/9/15
to
Thanks for trying to help!

I tested this but I did not get the information you got:
pi@pi2 ~/libtcl-perl $ sudo apt-cache policy libtcl-perl
N: Unable to locate package libtcl-perl

I installed the packages with:
sudo apt-get install debhelper tcl tcl-dev perl

I tried this:
pi@pi2 ~/libtcl-perl $ dpkg-buildpackage -uc -us
dpkg-buildpackage: source package libtcl-perl
dpkg-buildpackage: source version 1.02+ds-3
dpkg-buildpackage: source changed by Salvatore Bonaccorso
<car...@debian.org>
dpkg-buildpackage: host architecture armhf
dpkg-source --before-build libtcl-perl
dpkg-source: info: applying fix_hardening_FTBFS.patch
dpkg-source: info: applying wording.patch
fakeroot debian/rules clean
dh clean
dh_testdir
dh_auto_clean
dh_clean
dpkg-source -b libtcl-perl
dpkg-source: error: can't build with source format '3.0 (quilt)': no
upstream tarball found at ../libtcl-perl_1.02+ds.orig.tar.{bz2,gz,lzma,xz}
dpkg-buildpackage: error: dpkg-source -b libtcl-perl gave error exit
status 255

It didn't work. I tried this:

pi@pi2 ~/libtcl-perl $ perl Makefile.PL --tclconfig $(grep -Eo
'/usr/lib/.+/tclConfig.sh' /usr/lib/tclConfig.sh) --no-usestubs
Tcl config file '--no-usestubs' not found

It also did not work.

I could just wait until Raspbian is upgraded to Jessie.

I have the most updated system from the latest NOOBS:
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo rpi-update

It still says Wheezy though.

gregor herrmann

unread,
Mar 9, 2015, 4:30:26 PM3/9/15
to
On Mon, 09 Mar 2015 11:05:38 +0100, M.O.B. i L. wrote:

> I tested this but I did not get the information you got:
> pi@pi2 ~/libtcl-perl $ sudo apt-cache policy libtcl-perl
> N: Unable to locate package libtcl-perl

Right, I guess you're on wheezy and I'm on jessie :)

> I installed the packages with:
> sudo apt-get install debhelper tcl tcl-dev perl
>
> I tried this:
> pi@pi2 ~/libtcl-perl $ dpkg-buildpackage -uc -us
> dpkg-buildpackage: source package libtcl-perl
> dpkg-buildpackage: source version 1.02+ds-3
> dpkg-buildpackage: source changed by Salvatore Bonaccorso
><car...@debian.org>
> dpkg-buildpackage: host architecture armhf
> dpkg-source --before-build libtcl-perl
> dpkg-source: info: applying fix_hardening_FTBFS.patch
> dpkg-source: info: applying wording.patch
> fakeroot debian/rules clean
> dh clean
> dh_testdir
> dh_auto_clean
> dh_clean
> dpkg-source -b libtcl-perl
> dpkg-source: error: can't build with source format '3.0 (quilt)': no
> upstream tarball found at ../libtcl-perl_1.02+ds.orig.tar.{bz2,gz,lzma,xz}
> dpkg-buildpackage: error: dpkg-source -b libtcl-perl gave error exit
> status 255

Oops, sorry, I confused building a package from git and from a source
package.

You can download the missing .orig.tar.gz e.g. from

http://mirrordirector.raspbian.org/raspbian/pool/main/libt/libtcl-perl/libtcl-perl_1.02+ds.orig.tar.gz

put it in the directory above the source tree and run
`dpkg-buildpackage -uc -us' again.

> It didn't work. I tried this:
>
> pi@pi2 ~/libtcl-perl $ perl Makefile.PL --tclconfig $(grep -Eo
> '/usr/lib/.+/tclConfig.sh' /usr/lib/tclConfig.sh) --no-usestubs
> Tcl config file '--no-usestubs' not found

Sounds like /usr/lib/tclConfig.sh doesn't exist. Interesting.
Should be in tcl-dev. (But maybe not in wheezy.)

> It also did not work.
>
> I could just wait until Raspbian is upgraded to Jessie.

Or upgrade to jessie ...


gregor

--
.''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
: :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/
`. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
`- NP: Kurt Ostbahn & Kombo: Host recht
0 new messages