"Can't locate ExtUtils/MakeMaker.pm in @INC" 在 git 构建期间
"Can't locate ExtUtils/MakeMaker.pm in @INC" during git build
我在一个非常小的系统(Ubuntu 16.04 docker 图像)上构建 git
,没有使用包管理器(wget
、[=18 除外) =]、make
和 gcc
)。因此,我按如下方式安装了先决条件:
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 ..
但是,git
源根中的 make
由于
而失败
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
我知道有很多关于 Can't locate [module].pm in @INC
perl 项目的解决方案,How do I tell CPAN to install all dependencies?。然而,git
使用 GNU autotools 和可以解决问题的选项可能是从环境变量中读取的,到目前为止我无法弄清楚。
Ubuntu 16.04 提供了 perl
,但没有 cpan
命令(这就是我添加 perl
源安装的原因)。 perl
源码安装后能识别,但好像没有用:
$ which -a perl
/usr/local/bin/perl
/usr/bin/perl
$ which -a cpan
/usr/local/bin/cpan
在cpan
之后我得到
$ 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
设置是从引导脚本中抽象出来的,所以使用包管理器真的是别无选择。
如果您想调查环境,可以使用 docker run -i -t ubuntu:latest
。
我在 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.
提供了一个可重现的构建
将 ./configure --with-perl=/usr/local/bin/perl
用于 git
是可行的,但是我不清楚为什么 /usr/local/bin/perl
在 /usr/bin/perl
之前没有被提取,如果 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
。
添加 --with-perl
后 cpan ExtUtils::MakeMaker
不是必需的。
在CentOS7中遇到这个问题,我觉得应该先安装perl-devel
:
yum install perl-devel
然后重试。
我在一个非常小的系统(Ubuntu 16.04 docker 图像)上构建 git
,没有使用包管理器(wget
、[=18 除外) =]、make
和 gcc
)。因此,我按如下方式安装了先决条件:
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 ..
但是,git
源根中的 make
由于
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
我知道有很多关于 Can't locate [module].pm in @INC
perl 项目的解决方案,How do I tell CPAN to install all dependencies?。然而,git
使用 GNU autotools 和可以解决问题的选项可能是从环境变量中读取的,到目前为止我无法弄清楚。
Ubuntu 16.04 提供了 perl
,但没有 cpan
命令(这就是我添加 perl
源安装的原因)。 perl
源码安装后能识别,但好像没有用:
$ which -a perl
/usr/local/bin/perl
/usr/bin/perl
$ which -a cpan
/usr/local/bin/cpan
在cpan
之后我得到
$ 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
设置是从引导脚本中抽象出来的,所以使用包管理器真的是别无选择。
如果您想调查环境,可以使用 docker run -i -t ubuntu:latest
。
我在 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.
提供了一个可重现的构建将 ./configure --with-perl=/usr/local/bin/perl
用于 git
是可行的,但是我不清楚为什么 /usr/local/bin/perl
在 /usr/bin/perl
之前没有被提取,如果 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
。
添加 --with-perl
后 cpan ExtUtils::MakeMaker
不是必需的。
在CentOS7中遇到这个问题,我觉得应该先安装perl-devel
:
yum install perl-devel
然后重试。