The information below documents how I managed to get a working GCC compiler running on a Silicon Graphics Web Force Indy computer running the 6.2 version of IRIX. I pieced this information together after reading several of the Usenet newsgroups in the comp.os.sgi hierarchy plus a little experimentation. I had not seen all of the following information together in one place anywhere else on the net at the time I first put this page together.

I hope this helps others get GCC running on their IRIX based SGI computer.

Table of contents:

STEP 0: Before you begin...

  1. I strongly suggest you read ALL of the information on this page carefully before doing anything including the section near the bottom titled "A newer version of GCC". Follow the instructions exactly and in the order given to avoid problems. If you do run in to problems, make sure you don't have any other version of GCC left lying around from previous attempts to install GCC before starting to follow these instructions.
  2. The instructions which follow assume you have root level priveleges on the computer. If you do not, you will need to talk with your local system administrator and persuade the individual to preform the instructions below.
  3. If you are only running IRIX 5.3 and you don't have the IDO, you can not get a working GCC compiler since IRIX 5.3 is missing all the standard header files (such as stdio.h). One person reported getting GCC working under IRIX 5.3 but I don't have any details. You might be able to get GCC working under 5.3 by using the header files from one of the free versions of unix such as Linux or BSD but I have no way to test this.
  4. If you have not already done so, now would be a good time to install the eoe.hdr.lib inst package which can be found on your IRIX 6.2 (or later) CD. It contains all the standard C header files and is a must if you expect to compile anything useful later on.

STEP 1: Download the GCC compiler files

The company Micro Madness has a web site with software archives for Silicon Graphics computer users.

The files for GCC which you need to download are:


NOTE: See below for references to more recent versions of these files.

STEP 2: Install the compiler and libraries

Uncompress the two 'inst' images, un-tar them to a temporary directory, then use Software Manager to install them.

STEP 3: Installing binutils

The binutils package needs to be installed in to /usr/local/bin. This is not difficult to do, however, the tar file has (almost) all files under a directory called binutils-2.6 instead of under usr/local. This complicates the installation of the files within the binutils tar file slightly. Here in a nutshell is how to install binutils.

Make a temporary directory and cd in to it. Next untar the binutils file with 'tar xvfz binutils-2.6.tar.gz'. If you look at the directory you are in you should see only a binutils-2.6 directory. Cd to the binutils-2.6 directory. You will now see a few files and directories. These directories need to be copied to the /usr/local portion of your machine. The way I did this was to create a new tar file (using the command 'tar cvf ../new-binutils.tar .') and then cd to /usr/local and untar the file just created a moment ago.

The Installation, Links, Id, History, and README files are not needed and can be deleted from /usr/local.

At this point you should have a working compiler but you are still missing some files needed to link compiled source files into a working program. This is the part that gave me a lot of trouble until I came up with the solution shown in the next step.

NOTE: You will need /usr/local/bin in the search path in order to complete the rest of the steps listed below. You will also need to have this directory in the search path for any users intending to make use of the compiler.

STEP 4: Getting ready to run the linker

The first file missing is the actual linker program which must be obtained from an SGI running version 5.3 of IRIX. Currently the linker on an SGI running version 6.2 of IRIX will not work. Now you know why I said you should read this document before upgrading to version 6.2 of IRIX.

The linker program needed can be found in /usr/cpu/sysgen/root/usr/lib and is called 'ld'. Copy this file from the machine running IRIX 5.3 into the /usr/local/bin directory on the machine running version 6.2. It should still be called 'ld'.

An attempt to generate an executable program at this point revealed a missing object file, namely, the crt1.o object file. Later you will discover one more missing object file.

I looked over the Linux source for libc to see what its crt1.o file does. It confirmed my suspicions of crt1.o being a critical piece of code. It is the file which contains a routine called by the startup initialization code from the C library and eventually calls the main() routine in your C program.

I was somewhat fed up with looking for a useable crt1.o and waiting for people who were going to look so I started to wonder if I could create something that might work.

I created a crt1.c file as shown here:

void start(void)
    exit( main() );

The next step was to compile this file. This is not a catch-22 situation since only an object file is needed and not an executable program. I issued the command 'gcc -c crt1.c' to create the needed crt1.o file.

STEP 5: Testing the compiler

It was now time to try compiling a small, simple test program once again to see if I could generate a working program. I created a file called hello.c with the contents shown below. This is the (in?)famous "Hello, world" program.

#include <stdio.h>

void main(void)
    printf("Hello, world!\n");

I compiled this with GCC but when it tried to run the linker, I received a message that I needed crtn.o. My first thought was "Oh, no. Here we go again!".

I made another visit to the Linux libc source. It looked like this file simply contained various references to data and did not contain any actual code so I took a chance and created a zero length crtn.c file. You can create this file by using 'touch crtn.c'. I then compiled crtn.c to an object file. I tried to compile the "Hello, world" program again and this time link it with the two object files. This time I got an executable file. Hoorah!!

I took a deep breath and typed './hello'. I almost fell out of my chair when I saw "Hello, World!" appear on my screen and the program exited cleanly. (Actually, the first time I forgot the call to exit() in crt1 so it printed the message and blew up with a segmentation fault but it indicated I was on the right track.)

At this point I had the ability to turn C source files into executable program files. I copied the two object files (crt1.o and crtn.o) to the directory /usr/local/lib where they are expected to be at link time.

Final comments

I ran some tests to see if environment variables and argc/argv handling was working. As far as I have been able to tell, they both work as expected. My fear was that the crt1 file was responsible for parsing the command line and creating the argv[] array and also for making the shell environment variables accessible but this seems to be the job of the startup code which is run before the code in crt1.o ever gets called. I breathed a sigh of relief.

I have successfully compiled and ran many programs (starting with the source code) including both the regular and SSL-based versions of the Apache web server (versions 1.1.1, 1.1.3, and 1.2.x), Samba, a POP3 mail server, the wrapper function needed for the majordomo mailing list program, and the CMU SNMP package. All of them are working properly (barring any actual software bugs which may be in the programs).

PLEASE NOTE: Although I appear to have a working version of crt1.o and crtn.o, these should be considered experimental. I don't know what these files do in the versions supplied with the IDO. There may be things I am not doing that might be needed under certain circumstances. So far, everything I have compiled and run seems to work properly. Your mileage may vary. A smiley face

You may feel I have been a little long winded here but I felt that giving you the history of what I went through to get GCC up and running would make for reading considerably less dry than simple step-by-step "do this, do that" instructions.

A newer version of GCC

I received an E-mail message from Ancil Bethelmy on March 17 indicating that inst packages are available for the 2.7.2 versions of GCC and libg++. They can be found at: and are listed as gcc- and libg++-

I have made available a pre-compiled copy of binutils-2.9.1 to be used with the above GCC and libg++ components. Also, if you do not have access to the linker program from version 5.3 of IRIX, then you should also get the linker files from Ariel's web site. To install the linker files and the binutils files, simply 'cd /' and then use tar to extract the files from the tar file.

I have recompiled all of the programs I originally compiled using the 2.6.3 compiler but not with the 2.9.1 version of binutils. I have experienced no problems using the newer compiler and the 2.6 version of binutils.