Upgrade CPAN for Perl in Raspbian Linux fails

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:

formatting link
. 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:
formatting link
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:

formatting link
Going to read '/home/pi/.cpan/sources/authors/01mailrc.txt.gz' ............................................................................DONE Fetching with HTTP::Tiny:
formatting link
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:

formatting link
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:
formatting link
Fetching with HTTP::Tiny:
formatting link
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]>

Reply to
M.O.B. i L.
Loading thread data ...

M.O.B. i L. schrieb:

a quick google search point me to

formatting link

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

regards Ulf

Reply to
Ulf Volmer

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

formatting link
| perl - --sudo App::cpanminus wget
formatting link
tar xvf Tcl-1.02.tar.gz cd Tcl-1.02/ perl Makefile.PL sed -i 's|#include |#include "tcl-core/include/tcl.h"|' Tcl.xs make sudo make install sudo cpanm Tkx #

Reply to
M.O.B. i L.

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       |
Reply to
Martin Gregorie

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

formatting link
, 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:

formatting link
Going to read '/home/pi/.cpan/sources/modules/03modlist.data.gz' DONE Going to write /home/pi/.cpan/Metadata Fetching with LWP:
formatting link
CPAN: Digest::SHA loaded ok (v5.61) Fetching with LWP:
formatting link
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.

Reply to
M.O.B. i L.

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

--
Alex
Reply to
Alex Potter

Thanks it works!

Reply to
M.O.B. i L.

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:

formatting link

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.

Reply to
M.O.B. i L.

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

formatting link
testing/main amd64 Packages 990
formatting link
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

formatting link
jessie/main armhf Packages

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

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
Reply to
gregor herrmann

D]ZDze,9L$TL)$oI8]\U6.`>Ou8&TrrpF{Jg,>_N'P$\Q}d)`DibeD\0%~Uw; zte `9Hn7f@0|PTu%k?pcc9JO"yb40)KJIkkYU6L.T`,8~|\i% References: User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit

It might need more RAM than you have, and be terribly slow to build, but perlbrew (installer in the repo) allows you to keep a separate, CPAN-compatible build of a recent Perl under Debian without screwing up the system /usr/bin/perl.

Stewart

--
 this is not a signature
Reply to
Stewart C. Russell

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 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.

Reply to
M.O.B. i L.

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

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

formatting link

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

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

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
Reply to
gregor herrmann

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.