Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
362 views
in Technique[技术] by (71.8m points)

How to use patchperl when compiling an old perl distribution?

I am trying to compile (the 13 year old) perl 5.10.1 from source:

$ wget https://www.cpan.org/src/5.0/perl-5.10.1.tar.bz2
$ bunzip2 perl-5.10.1.tar.bz2
$ tar xvf perl-5.10.1.tar
$ cd perl-5.10.1
$ sh Configure -de -Dusethreads
$ make
[...]
cc -fstack-protector -L/usr/local/lib -o miniperl 
      gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro.o hv.o av.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  
    miniperlmain.o opmini.o perlmini.o 
/bin/ld: pp.o: in function `Perl_pp_pow':
pp.c:(.text+0x2e4c): undefined reference to `pow'
/bin/ld: pp.o: in function `Perl_pp_modulo':
pp.c:(.text+0x3c2b): undefined reference to `fmod'
/bin/ld: pp.o: in function `Perl_pp_atan2':
pp.c:(.text+0x8b4e): undefined reference to `atan2'
/bin/ld: pp.o: in function `Perl_pp_sin':
pp.c:(.text+0x8c6f): undefined reference to `exp'
/bin/ld: pp.c:(.text+0x8d19): undefined reference to `sqrt'
/bin/ld: pp.c:(.text+0x8d73): undefined reference to `cos'
/bin/ld: pp.c:(.text+0x8d8b): undefined reference to `sin'
/bin/ld: pp.c:(.text+0x8df3): undefined reference to `log'
collect2: error: ld returned 1 exit status
make: *** [makefile:348: miniperl] Error 1

Assuming there is an existing patch for this build problem, how can I apply the patch?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First install Devel::PatchPerl:

$ cpanm Devel::PatchPerl

Then from the root of the source tree, run:

$ patchperl
Auto-guessed '5.10.1'
Patching 'hints/linux.sh'
patching Configure
patching ext/Errno/Errno_pm.PL
patching Configure
patching utils/h2ph.PL
patching lib/h2ph.t
patching ext/SDBM_File/sdbm/sdbm.c
patching lib/Time/Local.t
patching pp.c
patching Configure
patching lib/Archive/Tar/t/02_methods.t
patching ext/ODBM_File/hints/linux.pl
patching make_ext.pl
patching ext/Hash-Util-FieldHash/t/10_hash.t
patching hv.c
patching t/op/hash.t
patching perl.c

Then recompile:

$ sh Configure -de -Dusethreads
$ make
[...]
../miniperl -I../lib find2perl.PL
Extracting find2perl (with variable substitutions)
 
make[1]: Leaving directory '/home/hakon/test/perl/perl-5.10.1/x2p'
 
    Everything is up to date. Type 'make test' to run test suite.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...