I'm building git
on a pretty minimal system (Ubuntu 16.04 docker image) without using the package manager (except for wget
, xz-utils
, make
and gcc
). I thus installed prerequisistes as follows:
apt-get update && apt-get install --yes wget xz-utils make gcc
wget http://www.cpan.org/src/5.0/perl-5.26.1.tar.gz && tar xf perl-5.26.1.tar.gz && cd perl-5.26.1 && ./configure.gnu && make -j16 && make install && cd ..
wget https://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.1.tar.xz && tar xf gettext-0.19.8.1.tar.xz && cd gettext-0.19.8.1 && ./configure && make -j16 && make install && cd ..
wget https://www.zlib.net/zlib-1.2.11.tar.gz && tar xf zlib-1.2.11.tar.gz && cd zlib-1.2.11 && ./configure && make -j16 && make install && cd ..
cpan install ExtUtils::MakeMaker
wget https://www.kernel.org/pub/software/scm/git/git-2.13.3.tar.gz && tar xf git-2.13.3.tar.gz && cd git-2.13.3 && ./configure && make -j16 && make install && cd ..
However, make
in the git
source root fails due to
Can't locate ExtUtils/MakeMaker.pm in @INC (you may need to install the ExtUtils::MakeMaker module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
Makefile:83: recipe for target 'perl.mak' failed
make: *** [perl/perl.mak] Error 2
make: *** Waiting for unfinished jobs....
Makefile:1870: recipe for target 'perl/perl.mak' failed
I'm aware that there're a lot of solutions regarding Can't locate [module].pm in @INC
for perl projects, How do I tell CPAN to install all dependencies?. However, git
uses GNU autotools and options which could fix the issue are probably read from environment variables which I couldn't figure out so far.
The Ubuntu 16.04 provides a perl
, but no cpan
command (which is why I added the perl
source installation). After the perl
source installation is recognized, but doesn't seem to be used:
$ which -a perl
/usr/local/bin/perl
/usr/bin/perl
$ which -a cpan
/usr/local/bin/cpan
After cpan
I get
$ find / -name MakeMaker.pm
/builds/project-0/perl-5.26.1/lib/ExtUtils/MakeMaker.pm
/builds/project-0/perl-5.26.1/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
/root/.cpan/build/ExtUtils-MakeMaker-7.32-0/lib/ExtUtils/MakeMaker.pm
/root/.cpan/build/ExtUtils-MakeMaker-7.32-0/blib/lib/ExtUtils/MakeMaker.pm
/usr/local/lib/perl5/5.26.1/ExtUtils/MakeMaker.pm
/usr/local/lib/perl5/site_perl/5.26.1/ExtUtils/MakeMaker.pm
$ perl -E 'say for @INC'
/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux
/usr/local/lib/perl5/site_perl/5.26.1
/usr/local/lib/perl5/5.26.1/x86_64-linux
/usr/local/lib/perl5/5.26.1
The setup is abstracted from a bootstrapping script, so using the package manager is really no option.
You can use docker run -i -t ubuntu:latest
in case you care to investigate the environment.
I provided a reproducible build at https://gitlab.com/krichter/git-docker-build and example output of the GitLab CI runner can be found at https://gitlab.com/krichter/git-docker-build/-/jobs/53888412.
using
./configure --with-perl=/usr/local/bin/perl
forgit
works, however it's unclear for me why/usr/local/bin/perl
isn't picked up before/usr/bin/perl
ifPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
.The
cpan ExtUtils::MakeMaker
isn't necessary after adding--with-perl
.In CentOS7, I encounter this issue, I find I should install the
perl-devel
firstly:Then retry it.