Difference between revisions of "Perlbrew"
Line 59: | Line 59: | ||
Copyright 1987-2009, Larry Wall | Copyright 1987-2009, Larry Wall | ||
.... | .... | ||
+ | </pre></code> | ||
+ | |||
+ | == compile perl for intel 32bits in a 64bits intel host == | ||
+ | With perlbrew you can also cross compile Perl for other processor architectures. This is how I did it for i686. | ||
+ | |||
+ | In a redhat host you need the 32 compilers, libraries etc to do it. | ||
+ | |||
+ | <code><pre> | ||
+ | $ perlbrew install perl-5.14.2 --as perl-5.14.2-i686-linux-thread-mult -Dcc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib/x86_64-linux-gnu/' -Darchname=i686-linux-thread-multi -Dusethreadscc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib' | ||
+ | </pre></code> | ||
+ | |||
+ | This will compile everything to your defined PERLBREW_ROOT dir. | ||
+ | |||
+ | When it's done, just switch to it: | ||
+ | |||
+ | <code><pre> | ||
+ | $ perlbrew use perl-5.14.2-i686-linux-thread-mult | ||
+ | $ perl -v | ||
+ | |||
+ | This is perl 5, version 14, subversion 2 (v5.14.2) built for i686-linux-thread-multi | ||
</pre></code> | </pre></code> |
Revision as of 10:45, 12 June 2013
Installing a system-wide perlbrew Perl
- create a directory where perlbrew will install the new Perl version:
# mkdir /opt/perl5 [enter]
I chose to do it in /opt/perl5; if we change the permissions on this directory, we do not need to run the rest as root.
- declare a (temporary) environment variable PERLBREW_ROOT
$ export PERLBREW_ROOT=/opt/perl5
- download the perlbrew script and run it:
$ curl -L http://xrl.us/perlbrewinstall | bash [enter]
$ /opt/perlbrew/bin/perlbrew init [enter]
I actually reviewed the script before executing it, do not just run stuff off the internet without knowing what you are doing.
- modify your login script
In my case I use the bash shell, so I modified my .bashrc file (log off and back in to see the changes later):
export PERLBREW_ROOT=/opt/perl5
source /opt/perl5/etc/bashrc
source /opt/perl5/etc/perlbrew-completion.bash
After this, just install a new Perl version. You will need a c compiler, make and patch:
$ perlbrew install perl-5.14.2 [enter]
$ perlbrew switch perl-5.14.2 [enter]
The 1st step could take a long time depending on how fast your host is. After it is done, you will have a new Perl at your disposal.
$ perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for i686-linux
Copyright 1987-2011, Larry Wall
.....
and this is the system's Perl:
$ /usr/bin/perl -v
This is perl, v5.10.1 (*) built for i386-linux-thread-multi
Copyright 1987-2009, Larry Wall
....
compile perl for intel 32bits in a 64bits intel host
With perlbrew you can also cross compile Perl for other processor architectures. This is how I did it for i686.
In a redhat host you need the 32 compilers, libraries etc to do it.
$ perlbrew install perl-5.14.2 --as perl-5.14.2-i686-linux-thread-mult -Dcc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib/x86_64-linux-gnu/' -Darchname=i686-linux-thread-multi -Dusethreadscc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib'
This will compile everything to your defined PERLBREW_ROOT dir.
When it's done, just switch to it:
$ perlbrew use perl-5.14.2-i686-linux-thread-mult
$ perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for i686-linux-thread-multi