/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.0.0//i686-apple-darwin10/bits/c++locale.h
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.0.0//powerpc-apple-darwin10/bits/c++locale.h
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.0.0//x86_64-apple-darwin10/bits/c++locale.h
ppc64 bits/* files are present in the 10.5 and 10.4u SDK.
I tried now the same experiment with g++-4.0: works for 10.4u and 10.5 SDKs without problem, for 10.6 compilation works (unlike g++-4.2), but linking fails, since on Snow Leopard, system libraries are only 3-way: i386 x86_64 ppc, i.e. ppc64 is missing:
g++-4.0 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk/ -arch ppc64 test.cpp -o test
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk//usr/lib/crt1.10.5.o, missing required architecture ppc64 in file
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk//usr/lib/powerpc-apple-darwin10/4.0.1/libstdc++.dylib, missing required architecture ppc64 in file
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk//usr/lib/libgcc_s.10.5.dylib, missing required architecture ppc64 in file
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk//usr/lib/libSystemStubs.a, missing required architecture ppc64 in file
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk//usr/lib/libSystem.dylib, missing required architecture ppc64 in file
Undefined symbols:
"_fdopen", referenced from:
_main in cckrrB6h.o
"std::ios_base::Init::Init()", referenced from:
__static_initialization_and_destruction_0(int, int)in cckrrB6h.o
"___gxx_personality_v0", referenced from:
___gxx_personality_v0$non_lazy_ptr in cckrrB6h.o
"std::ios_base::Init::~Init()", referenced from:
___tcf_0 in cckrrB6h.o
"___cxa_atexit", referenced from:
__static_initialization_and_destruction_0(int, int)in cckrrB6h.o
"_fwrite", referenced from:
_main in cckrrB6h.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
So to sum-up: Apple's developer tools contain only one g++-4.0 binary and only one g++-4.2. They also contain one SDK for each Mac OS X version for which it supports cross-compiling. These SDKs each contain system header files, system libraries, and gcc's internal headers (C++ standard library headers). The single g++-4.x binary uses, based on the SDK selected with -isysroot (macosx-version in boost.build), for linking different libraries and object files and for compiling different internal (and system) headers. Successful compilation with -arch ppc64 depends both on which g++ version you use (4.0 or 4.2) and which OS version you are (cross-)compiling for:
g++-4.2:
10.4 SDK: does not work for any arch (gcc 4.2 simply was not available in Tiger, C++ internal headers for 4.2 missing)
10.5 SDK: all archs work
10.6 SDK: -arch ppc64 does not work (Snow Leopard does not support running ppc64 executables ("Bad CPU type in executable"), it does support running ppc executables via Rosetta; and on Snow Leopard, system libraries are only 3-way: i386 x86_64 ppc; ppc64 is missing)
g++-4.0:
10.4 SDK: all archs work (but beware that not all system libraries are 4-way, some are only 2-way (32-bit) - see paragraph below)
10.5 SDK: all archs work
10.6 SDK: same as g++-4.2 wth 10.6 SDK, just does not fail on compiling (internal headers for ppc64 are not there so I don't understand this), but rather on linking (ppc64 internal object files and system libraries do not exist)
The only other thing to be aware of is that "g++" defaults to "g++-4.0" when building on Tiger and Leopard, and to "g++-4.2" when building on Snow Leopard.
So e.g. if you use g++-4.0 or g++-4.2 and compile for 10.5 SDK, you can get 4-way binaries running on 10.5 and later. If you use g++-4.0 and compile for 10.4 SDK, you can get 4-way binaries running on 10.4 or later, but be vary that on Tiger, e.g. system's libz is 4-way, but system's libbz2 is only 2-way (32-bit), so you have to supply your own 4-way bz2 to iostreams (only a few libraries on Tiger were 4-way). And if you do that with your own 4-way static build of libbz2, you run into boost.build's library path issue that I won't go into here (this post is already way longer than I intendet it to be).