[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Perl cross building support

An introduction: I'm one of the two GSoC students [1][2] 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.

[1]: http://wiki.debian.org/SummerOfCode2012/StudentApplications/PJMcDermott

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 [1], 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 [2]
(with both the old [3] and new [4] 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
feasibly do.

So, Wookey, I watched again your DC11 talk [5] and noticed that Colin
Watson said that Perl had been fixed to cross build properly.  I found
through the BTS [6] bugs #633884 [7] and #285559 [8], 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 [9] in Cross LFS - Sysroot.)
And the src:perl versions in sid and experimental still lack cross
building support.

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 [10] 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/debian/changelog
     +- perl-5.12.4/debian/patches/debian/cross-armel.diff
     |   +- 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/debian/patches/debian/cross-armhf.diff
     |   +- 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-5.12.4/debian/patches/debian/cross.diff
     |   +- perl/Cross/Configure.cross
     |   +- perl/Makefile.SH
     +- perl-5.12.4/debian/patches/series
     +- perl-5.12.4/debian/rules

Searching the upstream development mailing list, I found [11] 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?

[1]: http://os.pehjota.net/
[2]: http://perl5.git.perl.org/perl.git/blob/7a04c38f:/INSTALL#l1707
[3]: http://perl5.git.perl.org/perl.git/blob/7a04c38f:/Cross/README
[4]: http://perl5.git.perl.org/perl.git/blob/7a04c38f:/Cross/README.new
[5]: http://penta.debconf.org/dc11_schedule/events/745.en.html
[7]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633884
[8]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=285559
[10]: https://rt.perl.org/rt3/Public/Search/Simple.html?q=cross

P. J. McDermott                                        (_/@\_)    ,--.
http://www.pehjota.net/                           o    < o o >   / oo \
http://www.pehjota.net/contact.html                 o   \ `-/    | <> |.
                                                o o o    "~v    /_\--/_/

Reply to: