Jul 20, 2009

How to cross compile Perl

Download Perl from www.perl.org and extract it into a folder
The go to that folder and type
sh ./Configure -des -Dusecrosscompile \
-Dtargethost=[ip of the target] \
-Dtargetdir=/cross/bin \
-Dtargetuser=[user to SSH to the target]
-Dtargetarch=arm-linux \
-Dcc=/opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu-gcc \
-Dincpth=/opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/include \
-Dusrinc=/opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/include \
-Dlibpth=/opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/lib  
And then type make to build the Perl

The other solution which is simpler is as following
Download the http://www.rootshell.be/~axs/perl/ and extract it into existing Perl source code (5.10.0)

Then configure and compile it:
./configure --target=$target --sysroot=/mnt/target
make
make DESTDIR=... install

5 comments:

Unknown said...

Hi,
unfortunately link
http://rootshell.be/~axs/perl/perl-5.10.0-cross-0.1.tar.gz is broken and google does not provide alternative links. Do you have this file somewhere locally ? if so, could you please get it somewhere on the web or just email me at nick.vacula {at} gmail {dot} com ?

mjd said...

Hieu Le Trung, thanks for this article!

Unfortunately nick is right: That link is broken.

Do you have a copy that you can share with us?

Thanks!

mjd said...

That broken website is now back. Grab it while you can. I'm about to see if it works...

miudo.mau said...

The link is broken again. Could someone please repost it somewhere on the inernet. Perl cross compilation is a common problem.

Unknown said...

Get it here http://developer.berlios.de/project/showfiles.php?group_id=12304