[Pythonmac-SIG] building universal binaries

Ronald Oussoren ronaldoussoren at mac.com
Fri Jan 27 17:31:28 CET 2006


On 27-jan-2006, at 16:38, bear wrote:

> Ronald Oussoren wrote:
>>
>> On 27-jan-2006, at 4:22, bear wrote:
>>
>>> Ronald Oussoren wrote:
>>>> That part is easy enough. If you want a framework build you'll  
>>>> have to patch Makefile.pre.in because it contains a hardcoded '- 
>>>> arch ppc' in the section that builds that actual framework.  
>>>> Otherwise it should just build (assuming you have an intel mac  
>>>> of course, cross-building from PPC to Intel will be hard because  
>>>> the build process assumes you'll do a native build).
>>> ok, I found the relevant part in configure (and cofigure.in) that  
>>> was putting -arch_only ppc into the Makefile and I've re-run  
>>> configure and it seems happy - heck, even the compiling ran error  
>>> free.
>>>
>>> But when it got to the link part - I get the following error:
>>
>> You must replace the -arch ppc part by -arch i386. If you want to  
>> build a universal binary you'll have to replace the call to  
>> libtool by something more complex. I'll see if I can produce a  
>> patch later today.
> Coolness - I was able to get a clean build of python for the i386  
> arch just now.  I did have to apply a patch to Lib/plat-mac/ 
> applesingle.py so that it would run without errors.  I got the  
> required patch from http://www.opensource.apple.com/darwinsource/ 
> tarballs/other/python-16.tar.gz that Kevin mentioned in an earlier  
> post to this thread.
>
> Now to build the rest of our app and see how it fairs ;)
>

 From my Makefile.pre.in:

RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
                 $(LIBRARY) \
                 $(RESSRCDIR)/Info.plist \
                 $(RESSRCDIR)/version.plist \
                 $(RESSRCDIR)/English.lproj/InfoPlist.strings
         $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$ 
(VERSION)
         case "${LDFLAGS}" in \
         *"-arch i386"*"-arch ppc"*|*"-arch ppc"*"-arch i386"*) \
                 libtool -o $(LDLIBRARY).i386 -dynamic $ 
(OTHER_LIBTOOL_OPT) $(LIBRARY) -arch_only i386 \
                         @LIBTOOL_CRUFT@ ;\
                 libtool -o $(LDLIBRARY).ppc -dynamic $ 
(OTHER_LIBTOOL_OPT) $(LIBRARY)  -arch_only ppc \
                         @LIBTOOL_CRUFT@ ;\
                 lipo -create -output $(LDLIBRARY) -arch i386 $ 
(LDLIBRARY).i386 -arch ppc $(LDLIBRARY).ppc ;\
                 rm $(LDLIBRARY).i386 $(LDLIBRARY).ppc ;\
                 ;; \
         *"-arch i386"*) \
                 libtool -o $(LDLIBRARY).i386 -dynamic $ 
(OTHER_LIBTOOL_OPT) $(LIBRARY) -arch_only i386 \
                         @LIBTOOL_CRUFT@ ;\
                 ;; \
         *"-arch ppc"*) \
                 libtool -o $(LDLIBRARY).i386 -dynamic $ 
(OTHER_LIBTOOL_OPT) $(LIBRARY) -arch_only ppc \
                         @LIBTOOL_CRUFT@ ;\
                 ;; \
         *) \
                 libtool -o $(LDLIBRARY) -dynamic $ 
(OTHER_LIBTOOL_OPT) $(LIBRARY) -arch_only `machine` \
                         @LIBTOOL_CRUFT@ ;\
                 ;; \
         esac

This is very ugly. As you have noted you can't just drop -arch ppc  
because libtool than assumes that you want to do a 3-way universal  
build. Probably because libSystem contains a ppc64 binary.

I hope to have a script for building a "batteries included" universal  
build of python by the end of this weekend.

Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2157 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20060127/bbdc481c/attachment.bin 


More information about the Pythonmac-SIG mailing list