Solaris – Installing Perl modules on solaris 10

Print Friendly

Solaris 10 comes with pre-installed perl with a fixed set of perl modules. When you want extra modules on your system, the modules need to be compiled on the system and the process isn’t simple to be honest. Googled a lot and visited various links. With all the information gathered, I managed to install the modules I needed. The process is outlined as below. So if your OS is same as mine, hopefully installation of modules will be less painful.

This is how I installed Data Dumper on Solaris 10 box under a directory /opt/perl/modules.

Environment:


host1# uname -a
SunOS host1 5.10 Generic_142900-12 sun4v sparc SUNW,Sun-Fire-T200
host1# perl -v

This is perl, v5.8.4 built for sun4-solaris-64int
(with 32 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

Steps to compile the module:

1. Download the module from CPAN (http://cpan.perl.org/) on to you desktop and copy into a directory on the server from there. Gunzip, untar, and cd into the module directory.

host1# gunzip Data-Dumper-2.131.tar.gz
host1# tar xvf Data-Dumper-2.131.tar
host1# cd Data-Dumper-2.131

2. Run the following command to generate Makefile.

host1# /usr/perl5/bin/perlgcc Makefile.PL LIB=/opt/perl/modules PREFIX=/opt/perl/modules
Checking if your kit is complete…
Looks good
Writing Makefile for Data::Dumper

NOTE: If it complains about a missing module and you know it is installed, then set the perl library path, and run perlgcc again.
host1# PERL5LIB=$PERL5LIB:PATH_WHERE_MISSING_MODULE_IS_ALREADY_INSTALLED; export PERL5LIB

3. Run “make” to prepare the make file.

host1# make
cp Dumper.pm blib/lib/Data/Dumper.pm
/usr/perl5/5.8.4/bin/perl /usr/perl5/5.8.4/lib/ExtUtils/xsubpp -typemap /usr/perl5/5.8.4/lib/ExtUtils/typemap Dumper.xs > Dumper.xsc && mv Dumper.xsc Dumper.c
gcc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -O2 -fno-strict-aliasing -DVERSION=\”2.131\” -DXS_VERSION=\”2.131\” -fPIC “-I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE” -DUSE_PPPORT_H Dumper.c
Dumper.xs: In function `XS_Data__Dumper_Dumpxs’:
Running Mkbootstrap for Data::Dumper ()
chmod 644 Dumper.bs
rm -f blib/arch/auto/Data/Dumper/Dumper.so
LD_RUN_PATH=”” gcc -G Dumper.o -o blib/arch/auto/Data/Dumper/Dumper.so
chmod 755 blib/arch/auto/Data/Dumper/Dumper.so
cp Dumper.bs blib/arch/auto/Data/Dumper/Dumper.bs
chmod 644 blib/arch/auto/Data/Dumper/Dumper.bs

4. Run “make test” to check whether previous command worked correctly.

host1# make test
PERL_DL_NONLAZY=1 /usr/perl5/5.8.4/bin/perl “-MExtUtils::Command::MM” “-e” “test_harness(0, ‘blib/lib’, ‘blib/arch’)” t/*.t
t/bless………ok
2/11 skipped: no ‘re::regexp_pattern’
t/bugs……….ok
1/7 skipped: perl 5.10.1 crashes and DD cannot help it
t/dumper……..ok
t/freezer…….ok
t/overload……ok
t/pair……….ok
t/perl-74170….ok
t/terse………ok
All tests successful, 3 subtests skipped.
Files=8, Tests=420, 3 wallclock secs ( 2.33 cusr + 0.22 csys = 2.55 CPU)

5. Run “make install” to install the module.

host1# make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /opt/perl/modules/sun4-solaris-64int/auto/Data/Dumper/Dumper.so
Installing /opt/perl/modules/sun4-solaris-64int/auto/Data/Dumper/Dumper.bs
Installing /opt/perl/modules/sun4-solaris-64int/auto/Data/Dumper/Dumper.bs
Installing /opt/perl/modules/sun4-solaris-64int/Data/Dumper.pm
Appending installation info to /opt/perl/modules/sun4-solaris-64int/perllocal.pod
host1#

6. Run /usr/perl5/5.8.4/bin/instmodsh to verify the modules installed.

host1# instmodsh
Available commands are:
l – List all installed modules
m – Select a module
q – Quit the program
cmd? l
Installed modules are:
Data::Dumper
ExtUtils::Install
ExtUtils::MakeMaker
Parse::RecDescent
Perl
Test::Simple
cmd? q
host1#

, , , ,

sanaswati

2 Responses to “Solaris – Installing Perl modules on solaris 10”

  1. sanjay 21/07/2014 at 6:59 pm # Reply

    I don’t have root user access to server. I want to install perl 5.20 on Solaris in my user home directory.
    when I run make install command it gives me error that you do not have permission to write to /user/local/bin folder.

    Pls suggest how to overcome; As I do not have much server admin knowledge. My currenct compiler is GCC.

    After that I need to install LibXML.pm perl module

    Please advise

    • Ketan Patel
      Ketan Patel 28/07/2014 at 7:45 am # Reply

      Hi Sanjay, I haven’t had been in a situation where I’d to install without root access. But hopefully, the install script should give you an option to specify a different install location other than default /usr/local/bin.

Leave a Reply

*