Retrocomputing‎ > ‎

GCC 2.7.2.3 for SunOS 4.1.1

posted Mar 30, 2011, 6:07 PM by hyunghwan chung   [ updated Mar 30, 2011, 8:19 PM ]
The C compiler bundled in SunOS 4.1.1 is a pre-ANSI compiler that accepts the K&R style only. Some old GCC compilers that support SunOS 4  are still available from the GCC project site. In need of an ANSI C compiler, I chose to use one of the oldest gcc compilers available - gcc 2.7.2.3.

As my SunOS runs in TME without the Ethernet support, the first issue was how I could transfer gcc source files to the emulated environment. The first idea was to load the source tar-ball as the virtual tape.

$ mkdir ${HOME}/emulators/tme-sun3/gcc2723
$ cd ${HOME}/emulators/tme-sun3/gcc2723

$ wget http://ftp.gnu.org/gnu/gcc/gcc-2.7.2.3.tar.gz
$ gzip -d gcc-2.7.2.3.tar.gz
$ ln -sf gcc-2.7.2.3 01
$ cd ..

$ LTDL_LIBRARY_PATH=${HOME}/emulators/lib ${HOME}/emulators/bin/tmesh SUN3-CARRERA

After having started the emulator, I've loaded the tar-ball as a tape and powered up the machine.

tmesh> command tape0 load gcc2723/01
tmesh> command mainbus0 power up

After having logged into the emulated SunOS environment, I could view the tape contents with no problems initially.

suntme3$ mt -f /dev/nrst0 rewind
suntme3$ tar -tvf /dev/nrst0

However, I got caught in a serious problem when I tried to extract files from the tape. The problem was that a directory in the tape was extracted as a file and the files under the directory could not be extracted into the directory.


After some investigation, I've found out that it is the tar-ball format that caused the problem. To change the format, I've extracted all of the files on the host machine and recreated the tar-ball in the old V7 format.

I did the followings on the host machine.

$ cd ${HOME}/emulators/tme-sun3/gcc2723
$ gzip gcc-2.7.2.3.tar
$ tar -zxvf gcc-2.7.2.3.tar.gz
$ tar --format=v7 -cvf gcc-2.7.2.3.tar gcc-2.7.2.3
$ rm -rf gcc-2.7.2.3
$ ln -sf gcc-2.7.2.3.tar 01
$ cd ..

I've reloaded the virtual tape at the tmesh prompt.

tmesh> command tape0 unload
tmesh> command tape0 load gcc2723/01

I've extracted files from the tape after having rewound it at the SunOS prompt.

suntme3$ mt -f /dev/nrst0 rewind
suntme3$ tar -xvf /dev/nrst0

The rest of the build procedure follows the standard autoconf/automake procedure and it ran very smoothly.

suntme3$ cd gcc-2.7.2.3
suntme3$ ./configure
suntme3$ make
suntme3$ make install

After all these, I've got the compiler files installed in various subdirectories under /usr/local. See the screen-shot below for the error emitted by the stock K&R C compiler and successful compilation by GCC.



ą
hyunghwan chung,
Mar 30, 2011, 8:09 PM
ą
hyunghwan chung,
Mar 30, 2011, 8:09 PM
Comments