Compiling GCC 4.2.1 on a Sun Sun-Fire-280R running Solaris 2.9

This took a little while. Many things didn't work, but finally I was able to get a working set of compilers and tools.

My triplet is sparc-sun-solaris2.9, which was guessed by configure

I used -prefix=/usr/local/gcc/4.2.1 for everything

Compile gmp and mpfr (as directed by the gcc documentation) by explicitly specifing the above triplet. Do not let them figure it out for themeselves. Also, there are some source files that get generated with differnt contents based on a 32- or 64-bit compile. If you switch configuratons, you may have to delete the generated files so they get regenerated with the correct bit width.

I then compiled the binutils-2.17 using my existing compiler, gcc 3.4.4. I should mention that I tried to use the newest binutils (-2.18), but that failed miserably.

   ./configure --prefix=/usr/local/gcc/4.2.1
Now for gcc 4.2.1. I only wanted to make c, c++, fortran, and java. the bz2 pieces from the various archives unpacked in /usr/local/src/gcc-4.2.1

I did the configure and make from /usr/local/src/gcc-obj.421.

  CONFIG_SHELL=/bin/ksh
  export CONFIG_SHELL

  /usr/local/src/gcc-4.2.1/configure --prefix=/usr/local/gcc/4.2.1 \
        --with-gnu-as --with-gnu-ld \
        --with-build-time-tools=/usr/local/gcc/4.2.1 \
        --with-mpfr=/usr/local/gcc/4.2.1 --with-gmp=/usr/local/gcc/4.2.1

  LD_LIBRARY_PATH=/usr/local/gcc/4.2.1/lib:$LD_LIBRARY_PATH

  [ -f make.log ] && mv make.log make.log.old

  echo "build started: `date`" > make.log

  make >> make.log 2>&1 CFLAGS='-O' LIBCFLAGS='-g -O2' \
            LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap 

  rc=$?
  echo "build complete($rc): `date`" > make.log
The problems I encountered were some misnamed files in the dircetories. Two files in libstdcc ended with .hp instead of .hpp. I renamed them .hpp. eventually a similar problem showed up in the java libraries. a sound support file ended in . instead of .c. I made it .c. I checked the archives to see where the name problems showed up. I must conclude that the Solaris tar truncated the name. I switched to gnutar.

With all these problems corrected, the final compile worked!

I then used the compiler to compile make, gdb, and ddd.

  GCC4=/usr/local/gcc/4.2.1
  export GCC4

  PATH=$GCC4/bin:$PATH
  LD_LIBRARY_PATH=$GCC4/lib:$GCC4/lib/sparcv9:$LD_LIBRARY_PATH
  MANPATH=$GCC4/man
  INFOPATH=$GCC4/info:$INFOPATH
  export PATH LD_LIBRARY_PATH MANPATH INFOPATH

Testing The compiler

I ran the tests from testsuite. Unfortunately, many tests seem to fail but I think itis because we have an older version of tcl. If I can get a newer version installed, I may run the tests again.

If you have any questions, feel free to email me.

Stephen Corbesero
flash at cs.moravian.edu
Moravian College