4

I want to install 32 bit version of perl on my Cent OS server which is of course of 64 bit..Output of perl -v is

[root@M-229 ~]# perl --version

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

for that I have tried using yum and rpm and they both give only 64 bit versions, than I downloaded the perl-5.8.8.tar.gz file and tried installing from it. Even that didn't work and make gives following error

make: *** No rule to make target `<command-line>', needed by `miniperlmain.o'.  Stop.

I have tried instructions given on following links however that didn't work. Please help me in doing this.

this link

another link

and almost all links here

Please help,

EDIT I want to achieve this because their is 32bit opensource application is up and running on the machine. However in certain cases I found a bug. I downloaded the source code, understood and fixed the bug now I am not able to test the changes since all other .so are of 32 bits it gives me dlopen failed: /usr/local/garner/plugins/libfwstub.so: wrong ELF class: ELFCLASS64.

I am stuck at this point since last few days please help..

2 Answers 2

4
+50

The article HOWTO perlbrew a 32-bit Perl on a 64-bit Centos describes the following procedure :

A. Install perlbrew

You’ll need to install perlbrew from the CPAN, and it has a load of dependencies. The wonderful App::cpanminus makes this experience as painless as possible, so I installed it before moving onto perlbrew itself.

$ sudo yum install perl-CPAN
$ sudo cpan App::cpanminus
$ sudo cpanm install App::perlbrew

B. Initialise perlbrew

$ perlbrew init
$ perlbrew install-patchperl

Pay attention to the output of the init step - it will direct you to make a change to your shell configuration.

C. Install 32-bit Libraries

Installing these two packages was enough to build a 32-bit perl core. If you’re building additional XS modules against the 32-bit perl, they may require other 32-bit libraries to be installed.

$ sudo yum install glibc-devel.i686 libgcc.i686

D. Build A Perl

$ perlbrew install 5.8.9 -Accflags="-m32 -march=i686" -Aldflags="-m32 -march=i686" -Alddlflags="-shared -m32 -march=i686"
Fetching perl-5.8.9 as /home/zts/perl5/perlbrew/dists/perl-5.8.9.tar.bz2
Installing /home/zts/perl5/perlbrew/build/perl-5.8.9 into ~/perl5/perlbrew/perls/perl-5.8.9

This could take a while. You can run the following command on another shell to track the status:

  tail -f ~/perl5/perlbrew/build.perl-5.8.9.log

perl-5.8.9 is successfully installed.

That’s all there is to it, though the result isn’t quite perfect. While the above invocation builds a 32-bit perl, it doesn’t override the system’s archname - so the resulting @INC looks like this:

@INC:
    /home/zts/perl5/perlbrew/perls/perl-5.8.9/lib/5.8.9/x86_64-linux
    /home/zts/perl5/perlbrew/perls/perl-5.8.9/lib/5.8.9
    /home/zts/perl5/perlbrew/perls/perl-5.8.9/lib/site_perl/5.8.9/x86_64-linux
    /home/zts/perl5/perlbrew/perls/perl-5.8.9/lib/site_perl/5.8.9
    .

For my purposes, this is simply an aesthetic issue - the x86_64-linux directories contain 32-bit shared object.

2

I haven't tried it (and I do wonder why you would ever need 32-bit perl on a 64-bit system), but perhaps something along these lines would work. Adjust paths and configuration options as needed. (use ls and cd to find the right directories on your system, use ./configure --help to see available configuration options):

export CC="gcc -m32"
export CXX="g++ -m32"
export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"       
./configure --prefix=/usr --libdir=/usr/lib32 --enable-utf --enable-unicode-properties --enable-pcre16 --enable-pcre32 --enable-jit
make
5
  • Do I need to change anything in existing configure parameters ./configure --prefix= --sysconfdir=/etc --no-create --no-recursion --enable-clockevent.. please help...
    – Amit
    Aug 8, 2013 at 12:51
  • I don't have access to a CentOS computer, nor do I understand the need to do this in the first place, so you will just have to try it. If it configures, compiles and runs, it works. Another solution for running a 32-bit version of perl on a 64-bit computer is to run it in a virtual machine in a 32-bit OS.
    – Alexander
    Aug 8, 2013 at 12:54
  • I got this error... fwstub_yacc.o: file class ELFCLASS32 incompatible with ELFCLASS64
    – Amit
    Aug 8, 2013 at 13:00
  • Then you need a 32-bit version of yacc as well. You will need 32-bit versions of every library and dependency that perl uses. This is a lot of work.
    – Alexander
    Aug 8, 2013 at 13:02
  • In make file there is a line YACC = bison -y I think bison also has needs some 32 bit specific option...
    – Amit
    Aug 8, 2013 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .