如何在Ubuntu上安装Perl-5.8.9

时间:2019-09-10 07:22:56

标签: perl docker ubuntu

我有一个旧的Perl 5.8.9项目,需要在docker环境中运行。自从我在Ubuntu上开始使用它以来,我就尝试在Ubuntu 16.1和

上对其进行编译
FROM ubuntu

RUN apt-get update \
    && apt-get install -y curl \
    && apt-get install -y wget \
    && apt-get install -y perlbrew

NAME =“ Ubuntu” VERSION =“ 18.04.3 LTS(Bionic Beaver)” 图片

由于我在perlbrew上找不到版本,因此我尝试从下载的perl-5.8.9.tar.bz2进行编译 编译与miniperl有关。

perlio.c:515:2: note: in expansion of macro 'PerlLIO_write'
  PerlLIO_write(dbg, s, len);
  ^~~~~~~~~~~~~
perlio.c: In function 'PerlIO_parse_layers':
perlio.c:995:11: warning: this statement may fall through [-Wimplicit-                    
fallthrough=]
        if (*e++) {
       ^
perlio.c:1001:4: note: here
    case '\0':
    ^~~~
In file included from perl.h:3169:0,
                 from perlio.c:57:
perlio.c: In function 'S_more_refcounted_fds':
iperlsys.h:762:39: warning: ignoring return value of 'write', declared             with attribute warn_unused_result [-Wunused-result]
 #define PerlLIO_write(fd, buf, count) write((fd), (buf), (count))
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
perlio.c:2307:2: note: in expansion of macro 'PerlLIO_write'
  PerlLIO_write(PerlIO_fileno(Perl_error_log),
  ^~~~~~~~~~~~~
`sh  cflags "optimize='-O2'" perlapi.o`  perlapi.c
          CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -    I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -    O2  -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat -DPERL_GCC_PEDANTIC 
`sh  cflags "optimize='-O2'" numeric.o`  numeric.c
          CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -    I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -    O2  -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif-    labels -Wc++-compat -DPERL_GCC_PEDANTIC 
`sh  cflags "optimize='-O2'" mathoms.o`  mathoms.c
          CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -    I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -    O2  -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif-    labels -Wc++-compat -DPERL_GCC_PEDANTIC 
`sh  cflags "optimize='-O2'" locale.o`  locale.c
          CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -    I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -    O2  -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif-    labels -Wc++-compat -DPERL_GCC_PEDANTIC 
`sh  cflags "optimize='-O2'" pp_pack.o`  pp_pack.c
          CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -    I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -    O2  -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif-    labels -Wc++-compat -DPERL_GCC_PEDANTIC 
pp_pack.c: In function 'S_pack_rec':
pp_pack.c:2716:7: warning: variable 'was_utf8' set but not used [-    Wunused-but-set-variable]
   U32 was_utf8;
   ^~~~~~~~
`sh  cflags "optimize='-O2'" pp_sort.o`  pp_sort.c
          CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -    I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -    O2  -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif-    labels -Wc++-compat -DPERL_GCC_PEDANTIC 
`sh  cflags "optimize='-O2'" opmini.o`  -DPERL_EXTERNAL_GLOB opmini.c
          CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -vI/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -    O2  -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif-    labels -Wc++-compat -DPERL_GCC_PEDANTIC 
opmini.c: In function 'Perl_list':
opmini.c:977:5: warning: this statement may fall through [-Wimplicit-    fallthrough=]
  if (!o->op_next && cUNOPo->op_first->op_type == OP_FLOP) {
    ^
opmini.c:981:5: note: here
     case OP_LIST:
     ^~~~
opmini.c: In function 'Perl_mod':
opmini.c:1277:11: warning: this statement may fall through [-Wimplicit-v
fallthrough=]
  PL_hints |= HINT_BLOCK_SCOPE;
opmini.c:1278:5: note: here
     case OP_SASSIGN:
     ^~~~
opmini.c: In function 'Perl_fold_constants':
opmini.c:2119:40: warning: argument 'o' might be clobbered by 'longjmp'     or 'vfork' [-Wclobbered]
 Perl_fold_constants(pTHX_ register OP *o)
                                    ^
cc -L/usr/local/lib -o miniperl \
    `echo  gv.o toke.o perly.o op.o pad.o regcomp.o dump.o util.o mg.o     reentr.o hv.o av.o perl.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o     pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o xsutils.o     globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o     pp_sort.o  | sed 's/ op.o / /'` \
   miniperlmain.o opmini.o 
pp.o: In function `Perl_pp_pow':
pp.c:(.text+0x2d84): undefined reference to `pow'
pp.o: In function `Perl_pp_modulo':
pp.c:(.text+0x3b80): undefined reference to `fmod'
pp.o: In function `Perl_pp_atan2':
pp.c:(.text+0x8884): undefined reference to `atan2'
pp.o: In function `Perl_pp_sin':
pp.c:(.text+0x8978): undefined reference to `sqrt'
pp.c:(.text+0x8a23): undefined reference to `log'
pp.c:(.text+0x8a4e): undefined reference to `cos'
pp.c:(.text+0x8afb): undefined reference to `sin'
pp.c:(.text+0x8b13): undefined reference to `exp'
collect2: error: ld returned 1 exit status
makefile:313: recipe for target 'miniperl' failed
make: *** [miniperl] Error 1

是否有准备好的Docker映像? 如果没有,我该如何安装在ubuntu上,或者最好安装在高山或其他轻容器上。

3 个答案:

答案 0 :(得分:0)

在终端中依次运行以下命令。

sudo apt-get install perlbrew

perlbrew available

perlbrew install perl-5.8.9

如果下载失败,请创建如下所示的目录

mkdir -p perl5/perlbrew/dists 

再试一次以下命令

perlbrew install perl-5.8.9

有关更多信息,请参考:

https://askubuntu.com/questions/425427/how-to-install-perl-php-mysql-and-ruby-packages-on-ubuntu

答案 1 :(得分:0)

如果您不想使用perlbrew,这是另一种方法- 来自https://stackoverflow.com/a/44441545/2001559

在您的docker文件中-

RUN apt-get install -y gcc
ADD http://www.cpan.org/src/5.0/perl-5.8.9.tar.gz /shared
RUN tar -xzf perl-5.8.9.tar.gz

WORKDIR /shared/perl-5.8.9
RUN ./Configure -des -Dprefix=/opt/perl-5.8.9/localperl

RUN make
RUN make test
RUN make install

答案 2 :(得分:0)

perl-5.8.0

创建2个目录后,我解决了该问题:

mkdir -p /home/<username>/perl5/perlbrew/dists/
mkdir -p /home/<username>/perl5/perlbrew/build/perl-5.8.0

赋予rwx-rwx-rwx(以避免访问出现任何问题):

chmod -Rf 0777 /home/<username>/perl5/perlbrew/dists
chmod -Rf 0777 /home/<username>/perl5/perlbrew/build/perl-5.8.0