Solaris Resources at Kempston

Installing gzip, the gcc compiler and flex on Solaris 7 and Solaris 8

www.kempston.net/solaris/


Introduction

There are two compression programs used with Solaris. Of these, compress is supplied with Solaris but gzip isn't, so the first program you'll need to download and install is gzip.

The next program you'll need is a C compiler. Unusually for a unix system, there is no C compiler supplied as part of Solaris. This isn't a problem: an excellent GNUgcc compiler is freely available and this is generally considered to be better than Sun's own, and rather expensive, C compiler.

Finally, to complete the basic software tools, download and install flex. There's a program supplied with Solaris called lex. This is a lexical analyser which is needed prior to compiling many programs and, to be polite, doesn't work too well. In the immortal words of Alan Cox, "Take the Solaris lex and stick it up the backside of a passing Sun salesman, then install flex and use that. All will be happier".

gzip and gcc are available in pre-compiled package format from http://www.sunfreeware.com and are very simple to install.

flex is available in source code form from ftp://ftp.gnu.org/non-gnu/flex/flex-2.5.4a.tar.gz or from any GNU mirror; see the GNU FTP list. You'll need gcc to compile it.

This page provides detailed step-by-step instructions for installing gzip, the gcc compiler and flex. For general advice on installing and compiling software on Solaris, please see Installing software on Solaris 7 and Solaris 8


Installing gzip

1. Download the packaged binary

A pre-compiled binary package of gzip is available from http://www.sunfreeware.com. At the time of writing, the latest version for Solaris 8 Intel is supplied from this site in the file gzip-1.2.4a-sol8-intel-local and for Solaris 8 SPARC in the file gzip-1.2.4a-sol8-sparc-local . Versions for Solaris 7 are also available from this site.

Download this file into a temporary directory, such as /opt/temp


2. Install the gzip package

Installing the package is simply a matter of issuing the following commands:

	# cd /opt/temp
	# pkgadd -d gzip*


3. Modify the search path

You now need to modify the search paths so that the system can find the gzip programs and its manual page. If you're running the CDE windowing system, this is done by editing the file .dtprofile in your home directory and adding the following lines (if they aren't already there) to the end of this file:

	PATH=$PATH:/usr/local/bin:/usr/ccs/bin
	MANPATH=$MANPATH:/usr/man:/usr/local/man

It's advisable to log out and log in again at this point to activate these changes. Make sure that the system can find the gzip program:

	# gzip -h

and that you can display the manual page:

	# man gzip



Installing GNUgcc

1. Download the packaged binary

A pre-compiled binary package of gcc is available from http://www.sunfreeware.com. At the time of writing, the latest version for Solaris 8 Intel is supplied from this site in the file gcc-2.95.2-sol8-intel-local.gz and for Solaris 8 SPARC in the file gcc-2.95.2-sol8-sparc-local.gz . Versions for Solaris 7 are also available from this site.

Download this file into a temporary directory, such as /opt/temp


2. Decompress the package

To decompress the downloaded package file:

	# cd /opt/temp
	# gunzip gcc*

This replaces the downloaded file with the decompressed file gcc-2.95.2-sol8-intel-local or gcc-2.95.2-sol8-sparc-local.


3. Install the gcc package

Installing the package is simply a matter of issuing the following commands:

	# cd /opt/temp
	# pkgadd -d gcc*


4. Check that your system can find gcc

If you haven't already done so, modify the search paths as described above and check that gcc can be found:

	# gcc
	gcc: No input files



Installing flex

1. Download the source code

The source code of flex is available from ftp://ftp.gnu.org/non-gnu/flex or from one of the GNU mirrors. At the time of writing, the latest version is supplied from this site in the file flex-2.5.4a.tar.gz

Download this file into a temporary directory, such as /opt/temp


2. Decompress the distribution file

To decompress the downloaded distribution file:

	# cd /opt/temp
	# gunzip flex*

This replaces the downloaded file with the decompressed file flex-2.5.4a.tar


3. Untar the distribution file

Copy the decompressed tar file into a suitable source directory and untar it:

	# mkdir -p /opt/source/flex
	# cp /opt/temp/flex* /opt/source/flex
	# cd /opt/source/flex
	# tar xvf flex*

This creates a directory under /opt/source/flex called flex-2.5.4 with the source files in this new directory. Read the README and INSTALL files.


4. Compile and install flex

Compiling and installing flex is simply a matter of issuing the following commands:

	# cd /opt/source/flex/flex-2.5.4
	# ./configure
	# make
	# make check
	# make install



Has this guide been useful?

I hope these instructions prove useful. If you have any comments or suggestions for improvement, or have found any technical errors, please email me at mike@kempston.net

This page is copyright © mike@kempston.net 2000. Reproduction is forbidden without the author's permission. You are welcome to link to these pages if you wish but please point to the pages at www.kempston.net: Solaris Resources at Kempston


Home Free Solaris Connecting to an ISP
Configuring mail Configuring modem dialup Configuring a PPP server
Installing Software Solaris FAQs and Software Site Index

This page is maintained by the Kempston Webmaster
Last updated 11 November 2000