[haiku-development] GCC 2.95.x on Mac OS X Intel (10.5.x)

Greetings to all.

I was recently attempting to compile GCC 2.95.x as part of the cross- tools for Haiku, on Mac OS X.

For whatever reason, a lot of the documents (what little mention OS X) explicitly state that OS X Intel can only compile the cross-tools using GCC4. While this works fine on my system, the resulting Haiku build images are quite a bit slower in performance (for whatever reason) and obviously incompatible with older BeOS applications.

I don't know if the following is considered best practice or even "safe". I'm not a real "programmer" per say, so I apologize if this is a downright ugly hack- but I'm hoping someone can tell me the proper way of pulling this off so that it might be included in SVN sometime soon.

Anyways.

I had to make the following changes to the buildtools/legacy/gcc tree to get GCC 2.95.x to compile properly as a result of running `./ configure --build-cross-tools ../buildtools/`. **GCC4 WORKS FINE**- this has nothing to to with GCC4 and everything to do with GCC2 under Mac OS X Leopard on an Intel box.

First- add the following lines to buildtools/legacy/gcc/config.guess:

*:Darwin:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/ [-_].*//'`
 exit 0 ;;

Right before or after the *:FreeBSD:*:*) statement. Yes, I'm aware this is effectively making GCC think we're building on a host running FreeBSD, but Darwin is close enough- and it worked just fine.

Second- I had to clear out any content in buildtools/legacy/gcc/gcc/ *.texi.

For whatever reason, when I ran `./configure --build-cross-tools ../ buildtools/`, eventually I would get to compiling the GCC cross- compiler and a program called "makeinfo" would be called, segfaulting on any *.texi files. Apparently, it was trying to parse some sort of manual-like documentation from a *.texi file into a *.info file. Since these didn't exactly seem important, erasing the content of all *.texi files prevented makeinfo from crashing, and the build would continue.

Again, I'm almost positive this is a kludgy hack. But regardless, the end result is a working GCC 2.95.x cross-tools setup and I can build Haiku images just fine under OS X 10.5.4. The resulting VMware images are completely bootable, stable, and run legacy software (BeOS) just fine.

I'm not sure if someone wants to take a closer look into this- perhaps fixing config.guess under GCC so that it's done properly (however that may be), and or take a look into why makeinfo crashes if you don't clear out the contents of the *.texi files under /buildtools/legacy/ gcc/gcc/.

-KT

Other related posts: