SUMMARY: Install gcc-2.7.0 on Solaris 2.4 system

From: Sunmana at Cowboys (sunmana@cowboys.anet-dfw.com)
Date: Tue Apr 30 1996 - 18:43:05 CDT


Thanks a lot of people replied my question about installing
gcc-2.7.0 on a Solaris 2.4 system. It is those people that
makes the Sun Managers Interest Group such a valuable resource
in the UNIX world.

Please also be advised that the newest gcc is gcc-2.7.2.

My original question was:

======================================================================

Hi, Friends:

I have a question building and installing on a brand new
Solaris 2.4 system.

Part I:

We know Solaris 2.4 did not come with bundled C/C++ compiler.
So I grab a pre-compiled gcc-2.5.6 binaries from GNU's official
site and tried to use this compiler to build and install a newer
gcc compiler: gcc-2.7.0. Here comes the problem:

(1). Where should I put this pre-compiled gcc-2.5.6? In /opt or
in /usr/local? Or it doesn't matter?

(2). How do I put this pre-compiled gcc-2.5.6? What I mean is,
for example, if I want to put it at /opt, do I need to use the
`pkgadd` to install it or I can just move the the gcc-2.5.6.tar.gz
to /opt and gunzip and untar it?

(3). After successfully put the pre-compiled gcc-2.5.6 binaries to
where it should be, is there any path-related environment variables
I need to set before I use it to build gcc-2.7.0? If nothing needed
to be worry, how can system know use gcc (ie, gcc-2.5.6) to build &
install gcc-2.7.0?

Part II:

While I followed the instructions in the file INSTALL to try to build
gcc-2.7.0, the first step is <./configre>, it was running ok; the second
is <make LANGUAGES=c>, it was not so good, I got the following error
message, and the build process quit:

cc -DIN_GCC -DSVR4 -g -I. -I/home/tim/download/gcc-2.7.0/. -I/home/tim/download/gcc-2.7.0/./config \
  -DGCC_INCLUDE_DIR=\"/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include\" \
  -DGPLUSPLUS_INCLUDE_DIR=\"/usr/local/gcc/lib/g++-include\" \
  -DLOCAL_INCLUDE_DIR=\"/usr/local/include\" \
  -DCROSS_INCLUDE_DIR=\"/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/sys-include\" \
  -DTOOL_INCLUDE_DIR=\"/usr/local/gcc/sparc-sun-solaris2.4/include\" \
  -c `echo /home/tim/download/gcc-2.7.0/./cccp.c | sed 's,^\./,,'`
/usr/ucb/cc: language optional software package not installed
*** Error code 1
make: Fatal error: Command failed for target `cccp.o'

The process encountered a fatal error, so it quit and then I was stucked
here.

Can some gurus tell me what's going on here? What I missed here? What's the
strange symbol after each line?
(P.S. I installed everything on the Solaris 2.4 CD-ROM on my system)

I know I can go to the store and just buy a pre-compiled CD-ROM and install
it on my Solaris 2.4 system. But I would rather to build by myself to
learn something. But I'm stucked here.

I wonder whether somebody has any kind of log how and what are the
proper steps I need to successfully accomplish this.

I appreciate any kind of suggestion.

======================================================================

The answers to the above questions are:

Part I:

(1). Although it doesn't matter, the default place to put the
gcc-2.5.6 pre-compiled binaries is /opt. If you first gunzip &
untar the gcc-2.5.6.tar.gz, but not actually extract it, you'll
see the directory tree structure is to put it in /opt. So change
directory to root (/), then gunzip & untar it.

(2). Most of the gcc-2.5.6.tar.gz you get from the net is
distributed through the gzipped & tarred format, although
some are in Solaris package format. What I got was
gcc-2.5.6.tar.gz, it was a gzipped & tarred format, so I used
the following command to put it in root directory (/):
# cd /
# gunzip gcc-2.5.6.tar.gz | tar xvf -
(if you just want to take a look at the contents of the tarred
distribution, use tvf instead of xvf).

(3). Becuase I put gcc-2.5.6 binaries in /opt, so I need to include
the path /opt/gnu/bin. But be sure to put this path (/opt/gnu/bin)
in front of /usr/ucb/bin or /usr/ccs/bib.

Also make sure that /usr/ccs/bin is in your path, since the "make"
and other utilities are located there. If you don't include this
path, you'll get error messages.

Part II:

The error message that I was asking:
....
/usr/ucb/cc: language optional software package not installed
*** Error code
....

This error was because make tried to use /usr/ucb/cc. If you take
a look at this file (I mean, "more" it), you'll see it is just a
shell script. It servs no purpose other than to confuse people
into thinking that they have a compiler on a Solaris box, since it
won't acctually compile anything (as the error message showed).

There are two ways to get around this:
a). make a symbolic link from /usr/ucb/cc to /opt/gnu/bin/gcc
(or where you put your gcc-2.5.6 precompiled binaries).
or
b). See the following <Step 3>. Put a "CC=gcc" after make to
let make know use gcc, which was from gcc-2.5.6 binaries,
instead of cc to compile the distribution. This is what Part I,
(3) for.

Followed are my steps used to build the gcc-2.7.2:
(Assumed that I want to put the final binaries and libraries in
the directory /usr/local/gcc).

<Step 1>: Change directory to where you put your gunzip & untarred
gcc-2.7.2 distribution (for example: cd /usr/local/src/gcc-2.7.2):

<Step 2>: # ./configure --prefix=/usr/local/gcc

<Step 3>: # make CC=gcc LANGUAGES=c

<Step 4>: # make stage1

<Step 5>: # make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2" LANGUAGES="c c++"

<Step 6>: # make stage2

<Step 7>: # make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2" LANGUAGES="c c++"

<Step 8>: # make compare

<Step 9>: # make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="c c++"

<Step 10>: Setup up your $path and $MANPATH to properly include
the gcc binaries directory and the man pages.

That's it!

Thanks again for everyone that reponded. And hope this will help
those whose are in the same puzzle that I used to be in.

Sincerely,

sunmana
sunmana@cowboys.anet-dfw.com



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:59 CDT