Gnu Compiler Collection


Information Systems Department


This document describes the GNU Compiler Collection, GCC, (formerly the GNU C Compiler) as supported by ISD at UMIST. The GCC currently contains C, C++, Objective C, Fortran 77, Java and Ada 95 compilers.

The GCC is installed, available for use and supported on Cosmos, the UMIST general-purpose Solaris/Unix server and also in the PC Clusters on Windows NT. The GCC is also supported on Linux.

The GCC is a part of the GNU Project and is therefore available for free download, installation and use.


Document History

  1. First draught: 2001 June 28, Simon Hood.


Disclaimer

While ISD has taken great care in the preparation of this document, it assumes no responsibility for errors or omissions, or for problems resulting from the use of the information contained therein.


Copyright

Copyright © 2001, Information Systems Department, UMIST, Manchester, England.


1. Introduction

The Gnu Compiler Collection (GCC) consists of Gnu Compilers for C, C++, Objective C, Chill, Fortran 77, Ada 95, Java and more! The GCC is available for Windows 95/98/NT, Linux, Solaris and other flavours of Unix, on a variety of hardware.

The C/C++ compiler is the standard for open-source software.

The Java compiler, GCJ, is a portable, optimizing, ahead-of-time compiler for the Java programming language. It can compile: Java source code directly to native machine code; Java source code to Java bytecode (class files); and Java bytecode to native machine code. Compiled applications are linked with the GCJ runtime library, libgcj, which provides the core class libraries, a garbage collector, and a bytecode interpreter. libgcj can dynamically load and interpret class files, resulting in mixed compiled/interpreted applications.

The GCC is an example of "free software" released under the GPL.

The GCC Home Page includes links to further documentation, including a Frequently Asked/Answered Questions (FAQ) list.

There is no Gnu Fortran 90/95 at present. One has been started, but don't hold your breath. But, you might try the free F90 compiler from Pacific-Sierra Research which is available for Linux --- we do not support this compiler.


2. Availability at UMIST

The C/C++, Fortran and Java components of the Gnu Compiler Collection are installed and available for use at UMIST on Cosmos, the UMIST general-purpose Unix server, and also in the PC Clusters on Microsoft Windows NT. The GCC comes with every(?) Linux distribution.

The GCC is supported at Level 4 only, but there are busy news groups devoted to support for the GCC which should more than compensate. The GCC is installed, available for use, and supported on Cosmos, the UMIST general-purpose Unix server, and in the PC Clusters on Microsoft Windows NT. The GCC is also supported on Linux.


3. The GCC on MS Windows: CygWin

The GNU software is primarily aimed at the Unix/Linux world, hence the GCC uses utilities and libraries available as standard on Unix and unix-like operating systems, but which are not MS Windows platforms. The CygWin environment from Cygnus has been developed to workaround this problem. The installation procedure is described in Installation: Windows NT, below.

The CygWin documentation is available on-line.


4. Installation of GCC on Unix Platforms

This is really easy!


4.1. Solaris

Pre-compiled binaries in pkg format are available for Solaris from sunfreeware.com and its mirror sites, for example that at Imperial (e.g., gcc-2.95-2 for Solaris 2.8). Simply download the appropriate file (correct version of Solaris) and, as root, within the same directory as the downloaded file, type
    /usr/sbin/pkgadd -d <filename> 
This extracts the compiler and its associated files from the downloaded file and installs them in the correct place (/usr/local on Cosmos).


4.2. RPM-based Linux distributions (RedHat)

Most, if not all, Linux distributions come with GCC so the simplest option is to install GCC from your CDs using the setup/installation utility you used previously. If you do not have GCC, or want the very latest version, you can download the rpms, e.g., from RedHat or a mirror. For example, download


    gcc-2.96-81.i386.rpm  
    gcc-c++-2.96-81.i386.rpm  
    gcc-chill-2.96-81.i386.rpm  
    gcc-g77-2.96-81.i386.rpm  
    gcc-java-2.96-81.i386.rpm
    gcc-objc-2.96-81.i386.rpm
and

    libgcj-2.96-24.i386.rpm
and install each (as root) using
    rpm -ivh <file>.rpm
or
    rpm -Uvh <file>.rpm


5. Installation of GCC and CygWin on MS Platforms

To download and install the binaries start at the CygWin download page.

To install GCC on Windows NT you must first install the CygWin utilities --- in fact if you choose the automatic download and install of CygWin, then GCC will be installed as part of the process.

One can install the GygWin utilities and GCC manually, but the simplest way is to use the automatic ("smart") system provided. Simply download setup.exe to a temporary/working directory and run it! You will need to choose a destination directory for the Cygwin utilities, for example C:\CYGWIN; a connection type: direct, proxy or "use IE5 settings" (the latter worked fine for me); and a mirror site (I used sunsite.org.uk).

It is a good idea to read the README (if it exists) within the latest directory on your chosen mirror site; see also the FAQ (frequently asked/answered questions) on the CygWin site.


6. Usage on Linux and Solaris

In short, ensure that the executables are on your environment PATH; and the libraries are either (Solaris) on your LD_LIBRARY_PATH or their directory (Linux) is in your /etc/ld.so.conf and that ldconf has been run, then, at its simplest,
    gcc <filename>
The full usage of all compilers within the collection is well documented in the "Docs" section at the GCC web site.


7. Usage of CygWin and GCC on MS Windows; Bash on MS Windows

Full documentation is available on-line at the Cygnus web site. However, if you are like me and don't read documentation except as a last resort, you might like to know the following before using the Windows port of Bash, the usual way of using the GCC on this platform.

Unix and Windows mount drives very differently. CygWin's workaround is:




About this document:

Produced from the SGML: ./_reml_grp//gcc.reml
On: 31/9/101 at 12:40:18
Options: reml2 -i noindex -l long -o html -p single