Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Install Perl 5.10.1 on Ubuntu 14.04?

Tags:

ubuntu

perl

I've to install Perl 5.10.1 on Ubuntu 14.04 as per my requirement. When I download and install the package I get the following errors,

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 
pp.o: In function `Perl_pp_pow':
pp.c:(.text+0x2daf): undefined reference to `pow'
pp.o: In function `Perl_pp_modulo':
pp.c:(.text+0x39ee): undefined reference to `floor'
pp.c:(.text+0x3a21): undefined reference to `floor'
pp.c:(.text+0x3d94): undefined reference to `fmod'
pp.o: In function `Perl_pp_atan2':
pp.c:(.text+0x8a05): undefined reference to `atan2'
pp.o: In function `Perl_pp_sin':
pp.c:(.text+0x8ba2): undefined reference to `sin'
pp.o: In function `Perl_pp_int':
pp.c:(.text+0x9061): undefined reference to `floor'
pp.c:(.text+0x90d1): undefined reference to `ceil'
pp.o:(.rodata+0x120): undefined reference to `cos'
pp.o:(.rodata+0x128): undefined reference to `sin'
pp.o:(.rodata+0x130): undefined reference to `sin'
pp.o:(.rodata+0x138): undefined reference to `exp'
pp.o:(.rodata+0x140): undefined reference to `log'
pp.o:(.rodata+0x148): undefined reference to `sqrt'
pp_pack.o: In function `S_pack_rec':
pp_pack.c:(.text+0x72b3): undefined reference to `floor'
pp_pack.c:(.text+0x72d6): undefined reference to `floor'
pp_pack.c:(.text+0x7303): undefined reference to `floor'
collect2: error: ld returned 1 exit status
make: *** [miniperl] Error 1

I tried including math library <math.h> in the file pp.c but of no use. Is there anything more I need to do?

Also please tell me whether there is a tool that converts Perl 5.10.1 Script compatible with Perl 5.18.2 as I get backward compatibility warnings when I compile with 5.18.2.

like image 980
Yashwanth Aluru Avatar asked Oct 28 '25 09:10

Yashwanth Aluru


1 Answers

You could use perlbrew, a program that manages Perl installations.

  1. Install it using apt-get install perlbrew as root
  2. Initialize it by running perlbrew init
  3. Add source ~/perl5/perlbrew/etc/bashrc to your .bashrc and start a new shell.
  4. Install perl 5.10 using perlbrew install perl-5.10.1
  5. You can now use perlbrew use to change the Perl for the current shell, or perlbrew switch to change the Perl globally.

If you only need one Perl and want to avoid the complexity of perlbrew, you can try perl-build.

like image 105
user49740 Avatar answered Oct 30 '25 01:10

user49740