-arch option ignored?

Sorry if this has been answered before -- a quick search didn't dig up an answer for me.

I'd like to use the llvm-gg4 front-end for cross-compilation (ppc/x86 and vice versa) on Mac OS X.

I built it (e.g. on ppc) from source with a configure like this:

configure --with-gxx-include-dir=/usr/include/c++/4.0.0 --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-llvm=/usr/src/llvm/obj/ --enable-languages=c,c++,objc,obj-c++ --prefix=/opt/llvm-gcc

The back-end was built with all targets enabled.

Built like this, llvm-gcc generates ppc code regardless of the -arch flag (e.g. arch i386).

What can I do to make it behave like Apple's gcc in this matter?

Thanks for a hint.

Leo

You need to build darwin driver to use -arch. Try using build_gcc script to configure and build llvm-gcc.

Thanks for the hint, Devang.

You need to build darwin driver to use -arch. Try using build_gcc
script to configure and build llvm-gcc.

Well, I guess this task exceeds my expertise. I just thought there was some obvious mistake I made because a lot of people might be using llvm-gcc4 as a drop-in to Apple's gcc to build multi-architecture binaries.

I'll have a look at build_gcc, maybe I can figure this out. I guess that in future versions of the front-end binary releases for Mac OS X this problem won't exist anymore.

Kind regards.

Leo, don't feel bad. The process to get an "apple-style" build working takes a liberal amount of black magic.

Devang, Bill, Dale, do you guys happen to know how to run build_gcc without the buildit script driving it?

-Chris

No. I never looked at the buildit script. There be dragons there!

The build_gcc script could be scoured to look for how it uses the -arch stuff. From what I've seen as the build goes by on the screen, it builds llvm-gcc 4 times and then applies some magic afterwards to make it "universal." Search for "lipo" in build_gcc for more info.

-bw

Right, but it should be possible to invoke build_gcc directly, that way you don't have to replicate its intelligence. My hope for the next release is that we can do this for the llvm 2.1 binaries on mac os.

-Chris

Yes, it is simple. All buildit does is invoke GNUMakefile from
top level directory after setting appropriate variables.

buildit does not know anythig about build_gcc. It can not afford to learn
build_gcc magic, because it is a single interface to build all kind of
projects in the world.

GNUMakefile inovkes build_gcc. It should be easier to understand
build_gcc parameters from GNUMakefile. First and second build_gcc
parameters, $(RC_ARCHS) and $(TARGETS), sets host and target for
build_gcc. All other variables set by buildit and interpreted by GNUMMakefile
are easy to understand based on their name.