Perl cross building support
An introduction: I'm one of the two GSoC students  working on
making Debian easier to bootstrap, which of course requires cross
building at least enough packages to have a system capable of natively
building other packages.
The below message was originally sent to
a list setup for collaboration between our projects.
- - -
Wookey (and anyone else with interest and/or knowledge in this),
perl-base (from src:perl) is one of the packages that must be in the
base build system (it's marked "Essential: yes" and there are four
dependent Perl module packages marked "Priority: required"). So it will
be one of the packages I have to make sure can be cross built.
But when someone asked me a week ago about writing a program in Perl for
my embedded distro project , I realized that the Perl interpreter
can't really be cross built (my goal in that project is to cross build
every package). As I understood Perl's strange custom build system 
(with both the old  and new  cross compilation methods), it seemed
like it requires some commands to be executed on the host (using GNU
Autoconf terminology) system. (Perl's "Configure" script in fact runs
ssh and scp commands to connect to the host system.) This can hardly be
called cross building and isn't something that an OS distribution can
So, Wookey, I watched again your DC11 talk  and noticed that Colin
Watson said that Perl had been fixed to cross build properly. I found
through the BTS  bugs #633884  and #285559 , each of which has
a patch against an older version of Perl and hasn't been resolved. (I
also stumbled upon a rather intrusive patch  in Cross LFS - Sysroot.)
And the src:perl versions in sid and experimental still lack cross
The patch Steve McIntyre posted to #633884 applies to src:perl 5.12.4-1.
However, the versions in sid and experimental are 5.14.2-11 and
5.16.0-1, respectively. So I plan on looking through the upstream build
system and debian/rules to see what's changed in the newer versions and
how the patch might have to be updated. I don't yet have an sbuild
chroot setup with a cross toolchain, so I can't test the patch.
Also, I suppose I should at least forward any updated patch upstream, as
the src:perl maintainers would like comments from upstream.
(Surprisingly, it seems  no one has reported this as an issue upstream.)
Fortunately for both of those points (version differences and upstream
submission), the proposed patch is fairly unintrusive in the upstream
code. It only:
* adds cross configurations for armel and armhf (I'm not sure how
optimal this cross config stuff is though),
* adds a new "Configure" file in Cross/,
* modifies Makefile.SH, and
* enables cross building (by using the Perl installation on the build
system) in debian/rules.
(So only one upstream file is modified.) Full list of files patched:
$ echo perl-cross.debdiff; \
> grep -E '^diff|\+\+\+\+' perl-cross.debdiff | \
> sed -e 's/^diff .* / +- /' \
> -e 's/^\+\+\+\+ \(.*\)\t.*$/ | +- \1/'
| +- perl-5.12.4/Cross/arm-linux-gnueabi/bitcount.h
| +- perl-5.12.4/Cross/arm-linux-gnueabi/config.h.debug
| +- perl-5.12.4/Cross/arm-linux-gnueabi/config.h.shared
| +- perl-5.12.4/Cross/arm-linux-gnueabi/config.h.static
| +- perl-5.12.4/Cross/arm-linux-gnueabi/config.sh.debug
| +- perl-5.12.4/Cross/arm-linux-gnueabi/config.sh.shared
| +- perl-5.12.4/Cross/arm-linux-gnueabi/config.sh.static
| +- perl-5.12.4/Cross/arm-linux-gnueabi/uudmap.h
| +- perl-5.12.4/Cross/arm-linux-gnueabihf/bitcount.h
| +- perl-5.12.4/Cross/arm-linux-gnueabihf/config.h.debug
| +- perl-5.12.4/Cross/arm-linux-gnueabihf/config.h.shared
| +- perl-5.12.4/Cross/arm-linux-gnueabihf/config.h.static
| +- perl-5.12.4/Cross/arm-linux-gnueabihf/config.sh.debug
| +- perl-5.12.4/Cross/arm-linux-gnueabihf/config.sh.shared
| +- perl-5.12.4/Cross/arm-linux-gnueabihf/config.sh.static
| +- perl-5.12.4/Cross/arm-linux-gnueabihf/uudmap.h
| +- perl/Cross/Configure.cross
| +- perl/Makefile.SH
Searching the upstream development mailing list, I found  an archive
containing a new, more sane cross build system (written for Perl 5.12.3).
I have yet to look at it, so I'm not sure if it's better than the patch
Steve has proposed. Either way, it of course would also have to be
updated for the newer versions of Perl.
Am I going in the right direction with this? I figure I should work on
this a bit now even though I'm not yet cross building anything, as it
could take a while to enable support for cross building in src:perl.
(We don't need to have this one package holding us back from natively
bootstrapping the rest of the archive.) I just hope the other language
interpreters don't have similarly strange build systems (or are at least
Should I escalate the severity of #633884 from wishlist, since we need
src:perl to cross build?
And is it worth trying to get cross building support into wheezy's
src:perl before the freeze?
P. J. McDermott (_/@\_) ,--.
http://www.pehjota.net/ o < o o > / oo \
http://www.pehjota.net/contact.html o \ `-/ | <> |.
o o o "~v /_\--/_/