perl local::lib problems with some makefiles (eg: git manual installation)

30 December 2009

I tried to install the latest git in my ubuntu 9.04 and failed while trying to install some perl code. The makefile use prefix but does not check if there is a INSTALL_BASE variable already  defined in the system. This create a conflict having both prefix and install_base.

# installing git
sudo aptitude install git-core git-doc git-svn gitmagic gitweb
git-core git-doc git-svn gitmagic gitweb libdigest-sha1-perl{a} liberror-perl{a} libneon27-gnutls{a} libsvn-perl{a}
libsvn1{a}

#updating git:

http://blog.zobie.com/2009/07/installing-git-on-ubuntu-904-jaunty/

$ sudo apt-get build-dep git-core git-doc libssl-dev
$ wget http://kernel.org/pub/software/scm/git/git-1.6.3.3.tar.gz
$ tar -xzf git-1.6.3.3.tar.gz
$ cd git-1.6.3.3/
$ ./configure
$ make all doc
$ sudo make install install-doc
$ git --version
git version 1.6.3.3

[in my case wget http://kernel.org/pub/software/scm/git/git-1.6.5.6.tar.gz]

ERROR because Local::Lib exported variable: INSTALL_BASE

-----[error]------
/usr/bin/perl Makefile.PL PREFIX='/usr/local'
Only one of PREFIX or INSTALL_BASE can be given.  Not both.
make[1]: *** [perl.mak] Error 255
make: *** [perl/perl.mak] Error 2
-----------

!!! why /usr/bin/perl; ????? if I have my local perl 5.10.1 in my home and ‘which perl’ point to it. Seems that I would need to change the makefile options and the hardcoded perl location!!! <TO_DO>

$ make clean

<TO_DO> modify the makefile options for using my local perl 5.10.1 and use only the INSTALL_BASE (or only prefix deleting the install_base envvar)

[NB]
## how Local::Lib works: it exports some variables from an eval in your .bashrc:

 pablo@pmg-linux:~$ perl -I$HOME/localperl/locallib/lib/perl5 -Mlocal::lib=$HOME/localperl/locallib
 export MODULEBUILDRC="/home/pablo/localperl/locallib/.modulebuildrc"
 export PERL_MM_OPT="INSTALL_BASE=/home/pablo/localperl/locallib"
 export PERL5LIB="/home/pablo/localperl/locallib/lib/perl5:/home/pablo/localperl/locallib/lib/perl5/i486-linux-gnu-thread-multi:$PERL5LIB"
 export PATH="/home/pablo/localperl/locallib/bin:$PATH"

————

And similar problems reported in the web:

http://thread.gmane.org/gmane.comp.version-control.git/129906/focus=130343

From: Jakub Narebski <jnareb <at> gmail.com>
Subject: Re: [ANNOUNCE] GIT 1.6.5
Newsgroups: gmane.comp.version-control.git
Date: 2009-10-14 22:11:50 GMT (9 weeks and 26 minutes ago)

Junio C Hamano <gitster <at> pobox.com> writes:

> The latest feature release GIT 1.6.5 is available at the usual
> places:
>
>   http://www.kernel.org/pub/software/scm/git/
>
>   git-1.6.5.tar.{gz,bz2}			(source tarball)
>   git-htmldocs-1.6.5.tar.{gz,bz2}		(preformatted docs)
>   git-manpages-1.6.5.tar.{gz,bz2}		(preformatted docs)
>
> The RPM binary packages for a few architectures are found in:
>
>   RPMS/$arch/git-*-1.6.5-1.fc9.$arch.rpm	(RPM)
>
> This cycle took a bit longer than I hoped, but here it is.  We already
> have some new features cooking in 'next', and I expect we may be able to
> have 1.6.6 by the end of the year.

Compiling git from source RPM git-1.6.5-1.fc9.src.rpm using

  $ rpmbuild --rebuild git-1.6.5-1.fc9.src.rpm

fails with the following error:

    SUBDIR perl
/usr/bin/perl Makefile.PL PREFIX='/usr'
Only one of PREFIX or INSTALL_BASE can be given.  Not both.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.53174 (%build)

Compiling git from source with

 $ make prefix=/home/local/git \
        bindir=/home/local/git \
        gitexecdir=/home/local/git \
        template_dir=/home/local/git \
        GIT_PYTHON_DIR=/home/local/git 

gives the same error.

It might matter that I am using modern Perl way of installing Perl
modules locally, via local::lib, with ~/perl5/.modulebuildrc
containing 

  install  --install_base  /home/jnareb/perl5

and I have

  export MODULEBUILDRC="$HOME/perl5/.modulebuildrc"
  export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5"

Doing

 $ unset PERL_MM_OPT

before compiling (from SRPMS) made compilation pass this stage,
and finally succeed.

I guess that perl/Makefile (or rather the file that generates it)
should unset PERL_MM_OPT, or use INSTALL_BASE as DESTDIR rather
than fiddling with PREFIX.

But I am not a Perl hacker
------------------------------------------------------------
perl, v5.8.6
ExtUtils::MakeMaker 6.54 (local)
ExtUtils::MakeMaker 6.17 (global)

export MODULEBUILDRC="$HOME/perl5/.modulebuildrc"
export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5"
--
Jakub Narebski
Poland
ShadeHawk on #git