Compiling Perl 5.20.1

#See https://adrhc.go.ro/wordpress/common-commands-when-building/ for building environment, x.sh script and other things not defined here.
#Before starting do declare the environment variables specified to the link above.

#search http://search.cpan.org/ for modules
#see http://www.thegeekstuff.com/2008/09/how-to-install-perl-modules-manually-and-using-cpan-command/
#Installing Perl modules from CPAN (didn't work): http://perl.about.com/od/packagesmodules/qt/perlcpan.htm

#environment
export CFLAGS="-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error"
export BUILD_FLAGS="$CFLAGS -I/ffp/include"
export LIBS="-lintl"
export LDFLAGS="-L/ffp/lib $LIBS"
export CPPFLAGS="$BUILD_FLAGS"
export CXXFLAGS="$BUILD_FLAGS"

#building perl 5.20.1
~/x.sh ffpg
sh Configure -Dprefix='/ffp' -Duseshrplib
Build a threading Perl? [n] y
What libraries to use? -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat -lintl
What optimizer/debugger flag should be used? [-O2] -O2 -march=armv5te
Any additional cc flags? -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe $BUILD_FLAGS
Any additional ld flags (NOT including libraries)? [ -L/usr/local/lib] -L/ffp/lib
Shall I use /ffp/bin/nm to extract C symbols from the libraries? [y] n
Do you wish to use dynamic loading? [y]
#Any special flags to pass to cc -c to compile shared library modules? $BUILD_FLAGS
Run make depend now? [y] n
cccdlflags='-fPIC'
lddlflags='-shared -O2 -march=armv5te -L/ffp/lib'
ldflags='-L/ffp/lib'
optimize='-O2 -march=armv5te'
#sh Configure -S -> to run after config.sh is manually modified
make depend
nohup /ffp/bin/make -C ~/compile/perl-5.20.1 &

ERROR
	"can't get tcp protocol by name" for perl dist/Net-Ping/t/ tests
SOLUTION
	#see http://forum.nas-central.org/viewtopic.php?f=249&t=16561&hilit=iana
	#see http://www.iana.org/assignments/port-numbers
	#see http://sethwklein.net/iana-etc
	#you must have already installed one of these (they are the same considering the functionality gain): 
	https://adrhc.go.ro/ffp_0.7_armv5/packages/iana-etc-2.30-arm-0.txz -> this one has more comments (compared with stripped version)
	https://adrhc.go.ro/ffp_0.7_armv5/packages/iana-etc-2.30-arm-0-stripped.txz
	http://www.inreto.de/ffp/0.7/arm/packages/iana-etc-2.30-arm-1.txz
	#then add to fun_plug.local the commands below
	cp /ffp/etc/protocols /etc/protocols
	cp /ffp/etc/services /etc/services

#make minitest
nohup /ffp/bin/make test -C ~/compile/perl-5.20.1 &
tail -f nohup.out

#Install CPAN minus module
wget http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7023.tar.gz
#In order to work CPAN minus requires:
#ln -s /ffp/etc/protocols /etc/protocols
#CPAN minus might require Mozilla's CA Bundle certificate (search /ffp/bin/cpanm for cert.pem after installation).
#download the Mozilla's CA Bundle certificate:
#wget -nv http://curl.haxx.se/ca/cacert.pem -O /ffp/etc/ssl/cert.pem

#Install cpan-outdated module:
cpan install App::cpanoutdated
#or build yourself:
cd ~/compile
wget http://search.cpan.org/CPAN/authors/id/T/TO/TOKUHIROM/App-cpanoutdated-0.24.tar.gz
tar xvzf App-cpanoutdated-0.24.tar.gz
cd ~/compile/App-cpanoutdated-0.24
~/x.sh ffpg
perl Makefile.PL
#installing cpanoutdated required modules
cpanm CPAN::DistnameInfo
cpanm LWP
cpanm Module::Metadata
cpanm local::lib
... and others if asked ...
make
make test
make install
#In order to learn about outdated modules run:
cpan-outdated

#Install cpanlistchanges with CPAN:
cpan install App::cpanlistchanges
#or with CPAN minus:
cpanm App::cpanlistchanges
#If you want to see what is changed (Change-log) for CPAN module than run:
cpan-listchanges CPAN

#Building & installing Module-Build module.
cd ~/compile
wget http://www.cpan.org/authors/id/L/LE/LEONT/Module-Build-0.4210.tar.gz
tar xvzf Module-Build-0.4210.tar.gz
cd Module-Build-0.4210
~/x.sh ffpg
perl Build.PL
./Build
./Build test
./Build install

#Building & installing gettext module.
#needs:
export LIBS="-lintl"
export LDFLAGS="-L/ffp/lib $LIBS"
cd ~/compile/
wget http://search.cpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.05.tar.gz
tar xvzf gettext-1.05.tar.gz
cd gettext-1.05
~/x.sh ffpg
perl Makefile.PL
make
make test
make install

#When building help2man and perl has the module Locale::gettext I get the error:
#sh: error while loading shared libraries: libintl.so.8: cannot open shared object file: No such file or directory
#solved by (adding /ffp/lib to the end):
#export LD_LIBRARY_PATH=/usr/local/zy-pkgs/lib:/ffp/opt/serf-1.3.6/lib:/ffp/lib
#and also the error:
#help2man: can't get `--help' info from ./help2man
#Try `--no-discard-stderr' if option outputs to stderr
#solved by removing Locale::gettext perl module:
perl ~/tools/uninstall_perl_module.pl Locale::gettext -> only shows what files should be removed
#then remove by hand the Locale::gettext specific files

#Listing PERL modules
#original article http://www.linuxquestions.org/questions/linux-general-1/how-to-list-all-installed-perl-modules-216603/
instmodsh	-> also have capabilities to show module's files
#or
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
#or
#Perl Module Tools (https://metacpan.org/release/pmtools)
pmall - get all installed modules pmdesc descriptions
pminst - find what's installed
#or
cpan -l

#using cpanm to install App::cpanlistchanges module
cpanm App::cpanlistchanges
#using cpanm to reinstall XML::Simple module
cpanm --reinstall XML::Simple
#Shows the primary maintainers for XML::Simple module
cpan -A XML::Simple
#Show the XML::Simple module details
cpan -D XML::Simple

#upgrade a module using CPAN
#enter CPAN shell using:
cpan
#press h then ENTER for CPAN shell help
#report updates for DB_File module:
r DB_File
#report updates for CGI::Fast module:
r CGI::Fast
#upgrade CGI::Fast module:
upgrade CGI::Fast

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.