Boost logo

Boost-Build :

Subject: [Boost-build] Patch for building Boost 1.40 on Mac OS X Snow Leopard
From: Stuart A. Malone (samalone_at_[hidden])
Date: 2009-10-02 11:11:29


Today I took the time to patch my local copy of Boost 1.40 to allow
building under Snow Leopard. You can see discussions about this
problem in places like:

<http://continuous.wordpress.com/2009/09/06/building-boost-on-mac-os-x-10-6-with-xcode-3-2/
>

<http://archives.free.net.ph/message/20090903.114048.e961e539.en.html>

My patches address two problems:

- The -m64 option is incompatible with the generation of 32-bit binaries

- Versions of Apple's gcc 4.2 and later do not support generation of
ppc64 binaries

Since my company uses both gcc 4.0 and gcc 4.2, I wanted a solution
that still supports ppc64 binaries when using gcc 4.0, but avoids
creating ppc64 binaries under gcc 4.2 and later. I believe these
patches solve the problem and provide optimal behavior under both
Leopard and Snow Leopard, gcc 4.0 and 4.2.1.

Best wishes,

--Stuart A. Malone
   Llamagraphics, Inc.
   Makers of Life Balance personal coaching software
   http://www.llamagraphics.com/

Index: tools/build/v2/tools/gcc.jam
===================================================================
--- tools/build/v2/tools/gcc.jam (revision 3064)
+++ tools/build/v2/tools/gcc.jam (working copy)
@@ -373,7 +373,7 @@
             {
                 option = -m32 ;
             }
- else
+ else if $(model) = 64
             {
                 option = -m64 ;
             }
Index: tools/build/v2/tools/darwin.jam
===================================================================
--- tools/build/v2/tools/darwin.jam (revision 3064)
+++ tools/build/v2/tools/darwin.jam (working copy)
@@ -138,6 +138,13 @@
     {
         flags darwin.compile OPTIONS $(condition) : -Wno-long-double ;
     }
+ # - GCC 4.0 has the ability to generate ppc64 executables, which GCC 4.2 and later do not
+ local model = [ feature.get-values address-model : $(properties) ] ;
+ local architecture = [ feature.get-values architecture : $(properties) ] ;
+ if $(real-version) < "4.2.0" && $(model) = 32_64 && $(architecture) = combined
+ {
+ flags darwin.compile OPTIONS $(condition) : -arch ppc64 ;
+ }
 
     # - Set the link flags common with the GCC toolset.
     gcc.init-link-flags darwin darwin $(condition) ;
@@ -304,9 +311,11 @@
         : $(values) ;
 }
 
+# Generation of ppc64 for the combined/32_64 case is handled in the init rule
+# according to the version of GCC
 arch-addr-flags darwin OPTIONS : combined : 32 : -arch i386 -arch ppc : default ;
 arch-addr-flags darwin OPTIONS : combined : 64 : -arch x86_64 -arch ppc64 ;
-arch-addr-flags darwin OPTIONS : combined : 32_64 : -arch i386 -arch ppc -arch x86_64 -arch ppc64 ;
+arch-addr-flags darwin OPTIONS : combined : 32_64 : -arch i386 -arch ppc -arch x86_64 ;
 
 arch-addr-flags darwin OPTIONS : x86 : 32 : -arch i386 : default ;
 arch-addr-flags darwin OPTIONS : x86 : 64 : -arch x86_64 ;




Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk