[rt-users] General hints and tips when installing perl modules and using CPAN
Bob Apthorpe
arclight at jump.net
Wed Feb 27 18:42:02 EST 2002
Hi,
Following Bruce's lead, I'd like to add a few notes on perl and CPAN:
1) Before installing anything (else), manually upgrade CPAN.pm to the most
recent version. Download the tarball from cpan.org, unpack, and install as
any other perl module (perl Makefile.PL; make; make test; make install).
Do not use CPAN to install CPAN.pm. CPAN.pm versions 1.48 and earlier do not
ask permission before upgrading core perl when installing modules that are
now maintained as part of core perl (Data::Dumper, File::Spec, etc.) For this
reason, it's important to install a recent version of CPAN.pm and configure
it to ask permission before installing prerequisites, e.g.:
# perl -MCPAN -e shell
cpan> o conf prerequisites_policy ask
cpan> o conf commit
cpan> quit
You can also do this when you initialize CPAN for the first time.
2) Set CPAN to uninstall old modules when conflicts occur with
# perl -MCPAN -e shell
cpan> o conf make_install_arg UNINST=1
cpan> o conf commit
cpan> quit
You can also do this when you initialize CPAN for the first time.
3) CPAN stores downloaded modules under
$HOME/.cpan/sources/authors/id/Z/ZZ/ZZZ... so if you have trouble
installing modules automatically, you can find fresh sources here.
4) Solaris 8 users: I feel your pain. You have two choices with regards to
CPAN:
a) Scrape out the heinously borked version of perl 5.005_03 that Sun supplies
you and install a new (5.6.1 or later) clean copy from source so that all the
files go in the right places (Hint: /usr/perl5/bin is where vital utilities
like h2xs, h2ph, perldoc, and find2perl live. Paraphrasing Dave Barry, "Who
installed this code? Vandals?") Also, make sure the C compiler you build perl
with is available after installation (see below.)
b) Presuming you don't have Sun's C compiler (and who does?), save a backup
copy of
/usr/perl5/5.00503/sun4-solaris/Config.pm
and in the original, replace references to cc with gcc, being careful to
change the values of 'optimize' and 'cccdlflags' to reflect the appropriate
gcc options ('-KPIC' -> '-fPIC', '-xO3 -xdepend' -> '-O3').
/usr/perl5/5.00503/sun4-solaris/Config.pm 'remembers' how perl was built and
is used by CPAN (via MakeMaker) to build makefiles to install modules. You
can change some of the options in CPAN to convince it to use gcc instead of
Sun's hypothetical compiler but it's often much cleaner to erase cc from
Config.pm or just install a recent version of perl from scratch. I don't have
many comments about the Solaris packages of perl on sunfreeware.com or
sunsite/ibiblio; I've had good results with packages from both archives but I
simply don't trust *anyone's* package of perl, especially when Sun is
involved.
5) Perl 5.6.0 is a troubled version. If feasible, upgrade to 5.6.1 or later.
6) Rarely do I have to force-install a package. Tests generally fail for a
reason and really, you should investigate the failed tests before forcing an
installation, just to ensure the test results can be safely neglected. Some
tests fail if they're run as root. Common problems are missing library paths
(requiring LD_LIBRARY_PATH and LD_RUN_PATH to be specified) and missing or
outdated .ph files (perl-massaged include files for system libraries.) Update
the .ph files with:
cd /usr/include; h2ph -r -l .
You should only need to do this once, or whenever you update the contents of
/usr/include. See the h2ph manpage for details (Solaris users should use
'/usr/perl5/bin/perldoc /usr/perl5/bin/h2ph' instead...)
-- Bob
On Wednesday 27 February 2002 15:25, you wrote:
> ( This message is aimed for the archives and anyone trying to solve a
> particular problem. It contains broad advice )
>
> If you are attempting to install any of the perl modules listed in the
> subject line, please remember to have installed the include files and
> libraries that may be an optional part of the software package.
>
> Some, well-known, OS distributions offer you a choices of binary-only,
> binary-with-include, binary-with-lib (etc) installations of a given
> software package. For RT, these software packages are generally Apache
> and MySQL
>
> Please install the software package *with* the include files and *with*
> the libraries.
>
> You may not to be able to install certain perl modules (CPAN) without the
> software package's include and library files. Installing these may solve
> your problems.
>
> Linux 'binary' packages are the main culprits in this regards.
>
> Regards,
More information about the rt-users
mailing list