Hi there.
I use some Perl Modules in some of my application, accessed through
Camelbones.
I have notices that some Perl Modules use compiled C-Code, e.g. HTML-
Parser.
Now how does it work to build these modules as Universal Binaries?
Although my application is build as Universal Binary and I have been
told that it works with Intel-Macs the only thing that is not Intel
native are some Perl Modules that I use. The reason that it works
even on Intel-Macs with a PPC compiled Perl Module is Rosetta I guess.
Has someone experiences with that and can give me some hints?
Best regards,
Manfred
> I use some Perl Modules in some of my application, accessed through
> Camelbones.
> I have notices that some Perl Modules use compiled C-Code, e.g.
> HTML-Parser.
> Now how does it work to build these modules as Universal Binaries?
The README.macosx distributed with perl-5.8.8 tells you how to make a
universal binary perl. Once you have built and installed such a perl,
any modules that you build using that perl should end up as universal
binaries.
> Although my application is build as Universal Binary and I have
> been told that it works with Intel-Macs the only thing that is not
> Intel native are some Perl Modules that I use. The reason that it
> works even on Intel-Macs with a PPC compiled Perl Module is Rosetta
> I guess.
Well, maybe. I can't see why Rosetta would make ppc-architecture XS
modules work on an Intel Mac, unless the properties of /usr/bin/perl
had been tweaked (I believe it's done via Get Info) to make it always
run under Rosetta.
> Has someone experiences with that and can give me some hints?
I don't have experience -- you are on your own! While I have been
involved in hacking on the Darwin hints for Perl and updating the
README file, I don't have an Intel-based Mac to try things on, so
have not bothered to try a universal build. Reportedly, not even
Apple builds its universal perl in the way described in
README.macosx; instead, it does separate native build on each
platform, then stitches them together using the lipo utility -- see
<http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-01/
msg00731.html>. It may be that Apple also patches Config.pm and its
subordinates so that ExtUtils::MakeMaker (and its subordinates)
generate instructions to build universal modules, But I don't know.

Signature
Dominic Dunlop
Edward Moy - 13 Mar 2006 19:29 GMT
>> I use some Perl Modules in some of my application, accessed
>> through Camelbones.
[quoted text clipped - 19 lines]
>
>> Has someone experiences with that and can give me some hints?
In the modules I've tried:
% make 'PASTHRU_INC=-arch i386 -arch ppc' 'OTHERLDFLAGS=-arch i386 -
arch ppc'
was sufficient to build a 2-way universal (this is how Apple builds
the extra CPAN modules).
I understand there are some modules that don't uses these variables,
so hacking of the Makefile may be necessary.
Now that I think about it, we use universal systems, so I can't say
that I've actually tried it on a non-universal system. Seems to me
it should work, since the bundles don't need to resolve all their
symbols (including from libSystem). Let me know if it doesn't work,
as then Apple will need to figure out a solution.
> I don't have experience -- you are on your own! While I have been
> involved in hacking on the Darwin hints for Perl and updating the
[quoted text clipped - 7 lines]
> subordinates so that ExtUtils::MakeMaker (and its subordinates)
> generate instructions to build universal modules, But I don't know.
Nope, we build perl universal, much like README.macosx (though
without the SDK stuff). Then we strip out the architecture we don't
need to save space on the final hardware. We also strip out the -
arch flags from Config.pm because most users only want the
architecture that matches what they have.
------------------------------------------------------------------------
--
Edward Moy
Apple Computer, Inc.
emoy@apple.com
Dominic Dunlop - 13 Mar 2006 20:46 GMT
> Nope, we build perl universal, much like README.macosx (though
> without the SDK stuff). Then we strip out the architecture we
> don't need to save space on the final hardware. We also strip out
> the -arch flags from Config.pm because most users only want the
> architecture that matches what they have.
From the horse's mouth! Thanks for that.

Signature
Dominic Dunlop
Manfred Bergmann - 14 Mar 2006 00:18 GMT
Am 14.03.2006 um 05:29 schrieb Edward Moy:
>>> I use some Perl Modules in some of my application, accessed
>>> through Camelbones.
[quoted text clipped - 36 lines]
> symbols (including from libSystem). Let me know if it doesn't
> work, as then Apple will need to figure out a solution.
That seemed to word although I couldn't test it on a intel system but
the result of making the HTML-Parser (Parser.bundle) is a universal
binary.
Thx,
Manfred
Manfred Bergmann - 14 Mar 2006 00:12 GMT
Am 13.03.2006 um 23:38 schrieb Dominic Dunlop:
>> I use some Perl Modules in some of my application, accessed
>> through Camelbones.
[quoted text clipped - 6 lines]
> perl, any modules that you build using that perl should end up as
> universal binaries.
But that means I have to replace the existing Perl with the new one.
I would do it but I fear I that could break some things in the system.
Best regards,
Manfred