Cross-Compiling Perl

Jim Gifford lfs at
Wed Dec 28 13:38:39 PST 2005

Ken it's also needed for the building of glibc. Found that out the hard way.

I've used the current information on x86 to sparc, mips, and ppc with no 
problems. I just did this manually on a x86_64 cross attempt with no 
problems. Here is my history from bash. This was from a x86_64 multilib 

chmod 755 ext/util/make_ext
cp ext/util/make_ext{,.orig}
sed -e 's/miniperl/miniperl-cross/g' ext/util/make_ext.orig > 
chmod 755 x2p/Makefile.SH
cp x2p/Makefile.SH{,.orig}
sed -e 's/miniperl/miniperl-cross/g' x2p/Makefile.SH.orig > x2p/Makefile.SH
chmod 755 utils/Makefile
cp utils/Makefile{,.orig}
sed -e 's/miniperl/miniperl-cross/g' utils/Makefile.orig > utils/Makefile
./configure.gnu --prefix=/tools -Dstatic_ext='Data/Dumper IO Fcntl POSIX'
make miniperl
mv miniperl miniperl-cross
make clean
sed -e "s@\(^ar=\).*@\1'${AR}'@g" \
      -e "s@\(^ranlib=\).*@\1'${RANLIB}'@g" \
      -e "s@\(^cc=\).*@\1'${CC} ${BUILD32}'@g" \
      -e "s@\(^ld=\).*@\1'${CC} ${BUILD32}'@g" >
make miniperl
cp Makefile{,.orig
sed -e 's|(LDLIBPTH) ./miniperl|(LDLIBPTH) ./miniperl-cross|g' 
Makefile.orig > Makefile
make perl utilities
cp perl pod/pod2man /tools/bin
install -d /tools/lib/perl5/5.8.7
cp -R lib/* /tools/lib/perl5/5.8.7

jim at
lfs at

LFS User # 2577
Registered Linux User # 299986

More information about the cross-lfs mailing list