我建立git不使用包管理器一个相当小的系统(Ubuntu的16.04搬运工图像)(除wget,xz- utils,make和gcc)。因此,我安装了以下先决条件:
git
wget
xz- utils
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 ..
然而,make在git源根失败,因为
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 @INCPerl项目的解决方案,如何告诉CPAN安装所有依赖项?。但是,git使用GNU自动工具和可以解决该问题的选项可能是从到目前为止我还不清楚的环境变量中读取的。
Can't locate [module].pm in @INC
Ubuntu 16.04提供了perl,但没有cpan命令(这就是我添加perl源安装的原因)。perl识别源安装后,但似乎未使用它:
perl
cpan
$ 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在需要调查环境的情况下使用。
docker run -i -t ubuntu:latest
我在https://gitlab.com/krichter/git-docker- build上提供了可复制的版本,可以在https://gitlab.com/krichter/git-docker- build/-上找到GitLab CI运行器的示例输出。/ 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。
./configure --with- perl=/usr/local/bin/perl
/usr/local/bin/perl
/usr/bin/perl
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
在cpan ExtUtils::MakeMaker加入后是没有必要的--with-perl。
cpan ExtUtils::MakeMaker
--with-perl