SUMMARY - gcc on Solaris2.3

From: David Robson (
Date: Mon Nov 14 1994 - 03:21:33 CST

Lots of great help as usual! Basicly, getting the binaries was the easiest.

There is some confusion over what a Solaris box has as a compiler.
/usr/ucb/cc seems to be a compiler - but has problems.

Thanks to all :-)

My original post:
Can anyone give any practical advise on compiling gcc-2.6.0 on Solaris2.3?
> I just want the C compiler portion of gcc, so I use LANGUAGE="c". As
> standard, the system only has /usr/ucb/cc, which the INSTALL file warns
> against using, but whats the alternative?
> `configure' seems to run ok.
> `make LANGUAGES=c' seems to run ok
> `make stage1'
> make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O" LANGUAGE="c"
> This gives some errors (I'll have to run again to get them), but doesn't
> seem to be fatal.
> then
> make stage2
> make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGE="c"
> This blows up!
> xgcc: Internal compiler error: program as got fatal signal 10
> *** Error code 1
> make: Fatal error: Command failed for target `dwarfout.o'
> I tried to install :-]
> make install cc="stage2/xgcc -Bstage2/" CFLAGS="-g -O LANGUAGE="c"
> This blew up (no surprise)
> stage2/xgcc -Bstage2/ -DIN_GCC -DSVR4 -g -O -o genpeep \
> genpeep.o rtl.o ` case "obstack.o" in ?*) echo obstack.o ;; esac ` ` case "st
> e2/xgcc -Bstage2/"@"alloca.o" in "cc"@?*) echo alloca.o ;; esac ` ` case "" i
n ?
> *) echo ;; esac `
> ld: fatal: file genpeep.o: unknown type, unable to process using elf(3E) libr
> es
> ld: fatal: File processing errors. No output written to genpeep
> *** Error code 1
> make: Fatal error: Command failed for target `genpeep'
> Unfortunatly I don't have much skill with C, I just want a decent
> compiler for building of the net code! Please help! :-)

Grab the gcc binaries off of, and recompile with that.

Dan Stromberg - OAC/DCS


        Instead of trying to recompile gcc why don't you get a precompiled
        executable off of one of the Catalyst CD's. I think the one numbered
        5 should have a pretty up to date copy. Also if I am not mistaken
        did you remember to add the SDK supporting stuff when you loaded
        Solaris but wait are you sure you have a C compiler since Solaris
        did not come with a bundled C compiler.

                                                Andy Rodnite

I've had problem with big packages like this when my csh limits were set
too low (well, a mere 4096K datasize...). Try bumping your datasize to
something insane like 500M and running it again...

The other option from using suns 'cc' is getting the gcc binaries for an
older verion and compiling any new compilers with those...sounds like a
chicken and egg argument, eh?

  - Mike

        I haven't tried using it yet (I just got our Solaris 2.3 discs in the
mail the other day), but there's an article in SunExpert v5n10 October 1994
page 54 that gives step-by-step instructions for building and installing
GNU C. Like I said, I haven't followed them yet to see if they work, but
they didn't appear to be totally out to lunch. See if you can find the
magazine somewhere -- it's only a page worth of info. (If you're desperate,
I'd even type it in for you. :v)



I just finished compiling and installing gcc 2.6.0 on a Solaris 2.3
SPARC-10 not 5 minutes ago. Talk about coincidence!

I didn't have any problems, though. I did get the error messages for
stage1, they were of the order "crtbegin.o : no such file or directory",
but the stage2 compile (and the stage3 compile) went just fine. My
install went fine as well.

What is your path set to? You may be using the wrong binaries for some
of the compilation. My path is set to

(/opt/gnu/bin /usr/bin /usr/sbin /usr/ccs/bin .)

Also, is your GCC_EXEC_PREFIX set correctly? I installed the binaries
from (gcc 2.5.6), then set the environment variable

Do you have all the necessary packages installed?

Hope that helps!

Dave Hightower | opinion? I'm allowed to have an opinion?
Systems Manager | well, if I DID have one, it'd be mine, all mine!
Air Force Wargaming Center | "Dum vivimus, vivamus!" |

Hello David,

There is a copy of gcc for Solaris 2 which is already built. It can
also be installed with pkgadd. You can get it with an anonymous ftp


Raina J. Eckhardt
Systems Administrator
Seismology Division
Phillips Lab
Hanscom AFB, MA

I believe you can find it pre-compiled on

Bill Reed BP London

Why use /usr/ucb/cc when the INSTALL warns against it?
You should have no problems building gcc with the normal interface to
Sun's C compiler, in /opt/SUNwspro/bin/cc ; certainly the version 2.0.1
compiler can build gcc ok. If you have the version 3.0 C compiler installed,
then I suggest you upgrade to the latest version of Sun's C compiler: 3.0.1.

If you think that you don't have Sun's C compiler installed, and yet
/usr/ucb/cc works, then you are mistaken.

You should also be aware that the latest version of gcc is 2.6.1.

 David Robinson.

on Earlier in this mailinglist was a hint where
you can find the binaries as a solaris-installable package. After
installing the binaries, do the following:

1. Unpack the sources
2. ./configure --prefix=<installdir> sparc-sun-solaris2.3
3. make CC="<your-compiler-with-options>" CFLAGS="<compile-opts>" \
   LDFLAGS="<ld-opts>" LANGUAGES=c all stage1
   - if <your-compiler-with-options> is gcc, use the option
     -B<absolute-dir-of-cc1>/ . Don't forget the final / .
   - I used CFLAGS=-O and LDFLAGS=-s
4. Remove the first compiler (to save disk space)
5. Goto back to the gcc-src-dir and
   make CC="stage1/xgcc -Bstage1/" CFLAGS=-O3 LDFLAGS=-s \
   LANGUAGES="c c++ objective-c proto" all stage2
6. make CC="stage2/xgcc -Bstage2/" CFLAGS=-O3 LDFLAGS=-s \
   LANGUAGES="c c++ objective-c proto" all compare
7. If compare shows that all is okay, remove stage1 (to save disk space) and
   make CC="stage2/xgcc -Bstage2/" CFLAGS=-O3 LDFLAGS=-s \
   LANGUAGES="c c++ objective-c proto" install

Hope this was it. Have also a look to the Makefile

Guenter Millahn                       Cottbus University of Technology
Systems and Network Administrator     Computer Science Institute
Voice: +49 (355) 69-2711              P.O. Box: 10 13 44
Fax:   +49 (355) 69-2766              D-03013 Cottbus          GERMANY

If /usr/ucb/cc works, you als have /opt/SUNWspro/bin/cc.

Use that instead.

Did you use GNU as?


I think the best solution is to get a binary version of gcc for sol 2.3 (via anon-ftp). With this compiler you should be able to compile the current version of gcc. This is exactly the way I've installed gcc on our Sparcs under sol 2.3



+-----------------------------------------------------------------------------+ | Dipl. Stat. Thomas Koetter | | Institut fuer Statistik und Oekonometrie | | Fakultaet Wirtschaftswissenschaften | | Humboldt-Universitaet zu Berlin, 10178 Berlin, GERMANY | +-----------------------------------------------------------------------------+ | Tel. voice: +49 30 2468-321 | | Tel. FAX: +49 30 2468-249 | | E-mail: | +-----------------------------------------------------------------------------+

Hello. The installation of gcc with /usr/ucb/cc doesn't work as you see. You must look for binaries of another gcc, try archie. With this gcc you can install the new one (gcc-2.6.1 is available). Hope this helps. Wolfgang

----------------------- Wolfgang Leideck University of Mannheim Department of Practical Computer Science III A5, C220 68131 Mannheim Germany

Phone: ++ 49 621 292 1100 Fax : ++ 49 621 292 5007 Email: URL :


What I'd do is get the precompiled Solaris version from or (here you'll see a directory under the gnu directory something like solaris-sparc or sparc-solaris). Why would I do this? Because Solaris doesn't really come with a working compiler. Even if /usr/ucb/cc existed it isn't really there to be used.


/usr/ucb/cc is *NOT* a compiler. If you want to build gcc, get the binary distribution of gcc available in numerous places, and use it to build a more recent version.

-- Tim Evans | E.I. du Pont de Nemours & Co. | Experimental Station (302) 695-9353/7395 | P.O. Box 80357 EVANSTK AT A1 AT ESVAX | Wilmington, Delaware 19880-0357

THe alternative is to cross compile from another machine and/or OS.

Solaris2 machines don't generally HAVE C compilers.


-Dave Fetrow mail: SC-32 (Biostat), University of Washington, Seattle, Wa. 98195 USA phone: (206)-685-2376

On, there's a binary distribution of gcc, which you can use to build a new version.

This is covered in the comp.unix.solaris faq, along with many other pitfalls you may run into over time.

-- +----------------------------------------------------------------+ | Jon Hamilton | | | CS Solaris Systems Support Group, Iowa State University | +----------------------------------------------------------------+

Don't compile 2.6.0 unless you really have to. 2.5.8 is much stabler, and compiles without problems.


I compiled 2.6.0 successfully on Solaris 2.3 using the Solaris gcc 2.5.6 binary ... go to and get


You need the gzip binary because the gcc binaries are in a gzipped tarfile. Extract gzip, use it to uncompress the gcc binaries, then install (follow instructions; I don't remember the precise procedure). Then go ahead and install gcc 2.6.0. The installation procedure should find and use gcc 2.5.6.

Laurel Arthur Network Manager CSIRO Division of Wildlife and Ecology Canberra, ACT.

Since there is no C compiler bundled with Solaris, you almost have to download the gcc binary and use that to compile your own.


Sean Ward

-- David Robson (ROBBO),BHP Information Technology, P.O.Box 21, Whyalla South Australia 5600, Ph: +61 86 404881 Fax:...404720, E-mail Disclaimer: This is MY mail and I speak for myself and I. %-)

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:15 CDT