This page describes how to compile the GNU C and C++ 2.8.1 compilers (GCC) on the Silicon Graphics (SGI) IRIX 6.x platform. Previous versions of GCC did not support the IRIX 6.x platform; there were tricks available that allowed you to build an IRIX 5.3 compiler version, but there was no native support for the new n32 and 64 binary formats. The new 2.8.1 GCC versions supports IRIX 6.x in native mode.
The instructions on this page can also be used to compile egcs, according to Ian McKellar (thanks Ian!).
Instead of compiling GCC 2.8.1 yourself, you can also get a .tardist from Ariel Faigon's freeware for IRIX site. This package installs directly from the web.
Note: if you have build GCC 2.8.0 according to the instructions on this page, you should definitively upgrade to GCC 2.8.1 and build it according to this new instructions. After joining the gcc2 mailing list, it turned out that I made some mistakes in my compiling instructions.
Available mirrors for this page: [NL] [US]
The latest version of this page is always available here.
Before you build GCC, you have to decide if you want to compile libg++. Libg++ is considered obsolete and its functionality has been replaced by libstdc++. For compatibility reasons, there is still an up-to-date versions of libg++ available. If you have software that depends on libg++, you have to download and compile it; if not, libstdc++ is sufficient.
You'll get a copy of the world-famous freeware GNU C compiler on your IRIX system. GCC supports C, C++, and Objective C. You can use GCC for various reasons:
GCC supports both the n32 and the 64 ABI. GCC will generate n32 binaries as a default, but you can force it to generate 64 binaries by using the -mabi=64 command line option. The older 32 ABI is not yet supported, but you can generate an 32 compiler by just configuring for irix5.
That's it, you now have a running copy of GCC 2.8.1 on your system. If you want to install libg++, you'll have to compile and install it now. I don't need it, so I did not compile it. (If you provide me with building instructions, I will include them on this page).
To compile libg++, you have to untar the libg++ source in the libstdc++ directory. Now configure and install libstdc++ in the usual way, and libg++ will automatically be configured and installed in the right way. I have not tried this on IRIX machines, but it worked perfectly on a SunOS 4.1.3 machine. Your mileage may vary.
If you're using C++ templates, you can get the following
linker warnings when using g++:
ld: WARNING 131: Multiply defined weak symbol:(__tf6f_NODE) in
libfoo.a(bar.o) and
libgnu.a(gnats.o) (2nd definition ignored).
The linker is correct, but there's nothing you can do
about it; this is just the way g++ handles templates. If these
warnings annoy you, you can switch them off by editing the file
/usr/gnu/lib/gcc-lib/mips-sgi-irix6.3/2.8.1/specs:
search for the link entry and insert -woff
131 just before -_SYSTYPE_SVR4. In future
versions of g++, this warning will be switched off as a default.
If you are using a SGI MipsPRO 7.0 compiler, be sure to set the -32 flag when compiling the stage1 compiler. From Jim Wilson on the egcs mailing list (egcs@cygnus.com):
> 2. Is "cc -n32" support truly buggy, or can we use it?
Every SGI compiler I tried up through 7.0beta had a bug that
caused gcc to be miscompiled. 7.0beta had only a single bug,
which caused an optimization to be disabled, but did not cause
bad code. Hence if using 7.0beta, a stage2/stage3 comparison
would fail, but a stage3/stage4 comparison would succeed. The
one bug I reported against 7.0beta was fixed in 7.1. All
versions prior to 7.0beta have serious bugs that can not be
worked around easily.
I never tested any compiler after 7.0beta, by then I had
gotten in the habit of always using cc -32 when using the SGI
compiler. My suspicion though is that bootstrapping with -n32
would work with 7.1 and later compilers. The 7.1 compilers
have probably been out for 2 years or so by now.
Setting the -32 flag for the stage1 compiler can be done by using CFLAGS="-32" in step 5. I have not tried this (using a 7.1 compiler), so your mileage may vary.
You should also read Ariel Faigon's notes on using gcc 2.8.1.
Thanks to:
Back to my homepage.
Homepage of the Information and Communication Theory Group.
Ariel's Freeware for IRIX page.