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.

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.

2 Answers
2

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.

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:

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):

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.
–
AlexanderAug 8 '13 at 12:54