Installing gcc
Following the download procedures above, you should be left with a package named accordingly to your platform - and ending with ".local" in the filename. In order to install this package, you should be root or have root access as it installs in your /usr/local filesystem - or creates it if you don't have one. So, become root somehow by logging in as root, using the su or sudo commands or however your system is set up.
Next, issue the pkgadd (PacKaGe ADD or "package add"

command to install it on the system, changing the actual package name to fit the one you downloaded, for example:
# pkgadd -d gcc-2.95.2-sol7-sparc-local (hit return)
You will then be presented with the standard pkgadd response:
The following packages are available:
1 SMCgcc gcc
(sparc) 2.95.2
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
...to which you'll want to answer with an "all" or just hit return, since that is the default value. You'll see the files being installed start to scroll by on your screen and the package will be installed! Yes, it's that simple - and why we like packages, right?
You may be presented with a few questions along the way if you haven't installed any other packages in this fashion before, including the creation of the /usr/local directory or perhaps the permissions settings on various "conflicting" files. Just answer "y" to these questions and hit return.
Once the package has completed installing, you'll be returned to the command prompt after a brief line that reads, hopefully:
.
.
.
Installation of <SMCgcc> was successful.
# _
You can verify this and see some information about the package with the pkginfo (PacKaGe INFOrmation or "package information"

command:
# pkginfo -l SMCgcc (hit return)
PKGINST: SMCgcc
NAME: gcc
CATEGORY: application
ARCH: sparc
VERSION: 2.95.2
BASEDIR: /usr/local
VENDOR: Free Software Foundation
PSTAMP: Steve Christensen
INSTDATE: Mar 12 2001 13:26
EMAIL: steve@smc.vnet.net
STATUS: completely installed
FILES: 349 installed pathnames
10 shared pathnames
2 linked files
21 directories
23 executables
127203 blocks used (approx)
# _
Yours may vary slightly, but should more or less look like the above. You're all set, and should now log out as root and "be yourself" again.
Environment Variables
You may want to define a certain set of environment variables so that gcc knows where to find things, and will come in handy when compiling other Open Source software. Many utilities rely on environment variables like configure and make as well as gcc. If you are using the GNOME environment especially, it's good to set these up.
If you're using bash as your shell, just add the following lines into your ~/.bashrc file, or modify any existing lines to include those shown. You should of course, adjust these paths to your system - but for most situations, these will be appropriate:
export PATH=/opt/gnome/bin:/usr/local/bin:/opt/netscape:/usr/ccs/bin:$PATH
export LD_LIBRARY_PATH=/opt/gnome/lib:/usr/local/lib:/usr/lib:/lib
export GNOME_PATH=/opt/gnome
export MANPATH=/usr/local/man:/opt/gnome/man:$MANPATH
export CPPFLAGS="-I/opt/gnome/include -I/usr/openwin/share/include/X11/extensions -I/usr/openwin/include"
For the changes to take effect, you'll either need to log out and back in again, or start a fresh terminal window. You can also just enter "source ~/.bashrc" at the command-line to do the same thing. As a quick test, try entering the following at the command-line and you should see something like this:
$ set | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/opt/gnome/lib:/usr/local/lib:/usr/lib:/lib
$ _
These environment variables tell various utilities where files reside on your system. Important things like libraries, include files, man pages and even GNOME itself.
A Quick Test
If you want to make sure that it's working and wish to perform a quick test, why not use the old standby of a "hello world" program? What article on a language would be complete without it...
Using the text editor of your choice, create a file called "helloworld.c" in your home directory and enter the following code:
main()
{
printf("Hello world.\n"

;
}
Okay, so it's not the best C program in terms of what it does or ANSI C correctness, but it will suffice to test the install. Next, on the command line we'll compile this C source code into a usable Solaris binary:
$ gcc helloworld.c -o helloworld (hit return)
$ _
If all goes well, you'll be returned to the command line with no further output. Pretty simple, no? What you're left with is a binary called "helloworld" which is ready to execute:
$ ./helloworld (hit return)
Hello world.
$ _
If this is what you got, congratulations! If not, resolve any errors you get in response to the compiler (known as warnings) and try again. You've now successfully installed gcc and compiled a very simple test program.
You're now ready to move on to bigger and better things - enjoy!
I copied from
EverythingSolaris
.
Farah regal
good luck
"think twice and hit enter once"