Boost logo

Boost Users :

Subject: Re: [Boost-users] (was Re: 1.40.0 - 32_64 broken on OS X 10.6 Snow Leopard) (now ppc64 support removed with Xcode 3.2 on Snow Leopard.
From: Boris Dušek (boris.dusek_at_[hidden])
Date: 2009-09-07 09:26:00


I think I got it with Snow Leopard and 32_64. First, looking at the lines
with "arch-addr-flags", I realized what I really needed was architecture=x86
address-model=32_64 instead of architecture=combined address-model=32_64 (I
needed Intel-only binaries, but I tested this also works for
architecture=combined if you remove the -arch ppc64 from
tools/darwin.jam:307-317). This removed the unfound bits/* headers error,
but created a new one:
darwin.compile.c++
bin.v2/libs/iostreams/build/darwin-4.2.1/release/address-model-32_64/architecture-x86/threading-multi/file_descriptor.o

    "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall
-dynamic -no-cpp-precomp -gdwarf-2 -arch i386 -arch x86_64 -fPIC -m64
 -DBOOST_ALL_NO_LIB=1 -DBOOST_IOSTREAMS_DYN_LINK=1 -DNDEBUG -I"." -c -o
"bin.v2/libs/iostreams/build/darwin-4.2.1/release/address-model-32_64/architecture-x86/threading-multi/file_descriptor.o"
"libs/iostreams/src/file_descriptor.cpp"

lipo: /var/folders/hh/hh89RPWHGkKJgJC3Gy-ZZk+++TI/-Tmp-//ccXdF5pl.out and
/var/folders/hh/hh89RPWHGkKJgJC3Gy-ZZk+++TI/-Tmp-//ccg03e1J.out have the
same architectures (x86_64) and can't be in the same fat output file
...failed darwin.compile.c++
bin.v2/libs/iostreams/build/darwin-4.2.1/release/address-model-32_64/architecture-x86/threading-multi/file_descriptor.o...

I tried the same g++ command-line, but with "-m64" removed, and it worked
and created the proper fat object file:

$ lipo -info
bin.v2/libs/iostreams/build/darwin-4.2.1/release/address-model-32_64/architecture-x86/threading-multi/file_descriptor.o
Architectures in the fat file:
bin.v2/libs/iostreams/build/darwin-4.2.1/release/address-model-32_64/architecture-x86/threading-multi/file_descriptor.o
are: i386 x86_64

I found that -m64 is being set in tools/gcc.jam based on the address-model
at around line 377. So I added a check whether the model is 32_64, and add
-m64 only if 32 is not set *and* 32_64 is not set:

            if $(model) = 32
            {
                option = -m32 ;
            }
            else
            {
                if $(model) = 32_64
                {
                }
                else
                {
                    option = -m64 ;
                }
            }

Then I compiled with architecture=x86 address-model=32_64 and got universal
binaries as I needed:

$ lipo -info lib/libboost_iostreams-xgcc42-mt.dylib
Architectures in the fat file: lib/libboost_iostreams-xgcc42-mt.dylib are:
i386 ppc7400 x86_64

$ lipo -info lib/libboost_iostreams-xgcc42-mt-1_40.dylib
Architectures in the fat file: lib/libboost_iostreams-xgcc42-mt-1_40.dylib
are: i386 x86_64

I also tried architecture=combined address-model=32_64 (after I removed
-arch ppc64 from tools/darwin.jam), and confirmed that again, the "-m64" is
what causes errors (I tested that it somehow forces 64-bit even if you
previously specify 32-bit arch(s) with -arch option). With the same fix for
-m64, this works:

In my opinion, more proper would be to:

1. in tools/gcc.jam:(352-383), if the toolset is darwin, don't setup
address-model flags (-m32 and -m64), since these are taken care of in
tools/darwin.jam (and in a correct way specific for Apple's gcc).
2. in tools/darwin.jam:(307-317), somehow check for the version of SDK (or
version of OS X, don't know which one is more correct) and based on that,
handle the unavailable -arch ppc64.

On a side note, I hope boost.build will soon be in Python, which I know
well, since then I am willing to learn Boost.Build and submit proper patches
without hacks :-)

Cheers,
Boris

On Sun, Sep 6, 2009 at 2:34 AM, JungleCat <junglecat_at_[hidden]> wrote:

> ok, the problem is that you cannot compile c++ into ppc64 machine code on
> Snow Leopard because it doesn't ship with a ppc64 bit version of the SDK.
> The following is the culprit in darwin.jam
>
> arch-addr-flags darwin OPTIONS : combined : 64 : -arch x86_64 *-arch ppc64
> *;
>
> My last post demonstrated the failure but you cannot build through Xcode
> because it will bail with the same error. My take is that Apple is dropping
> support for ppc64 but I have no confirmation other than they do not ship the
> ability to target this anymore.
>
> Julian
>
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net