User Tools

Site Tools


guide:compiling_gcc

This is an old revision of the document!


Compiling GCC from Source

This guide is written as to try and help CHPC users who are struggling to compile the GCC version required for there codes. For the official guide on compiling GCC please visit the GCC website. This guide documents how gcc-4.6.2 would be built on the Sun Tsessbe Cluster.

Before you begin, make sure your bash environmental variable are set correctly, for example . Also it recommended that you make you use of temporary or scratch directory to do all you work in (~/scratch or /tmp).

Also note that for this guide, all binary and libraries are installed home directory, i.e prefix=$HOME.

Prerequisites

A table showing what tools and package for building GCC, and what is available on the cluster login node (this is where GCC will be built)

Prerequisite Version Required (or later) Available
ISO C90 compiler GCC binary version 2.95 gcc 4.3.4 (under /opt/gridware)
GNAT ? ?
A “working” POSIX compatible shell, or GNU bash bash available
awk GNU awk version 3.1.5 GNU awk version 3.1.5
GNU binutils ?
gzip 1.2.4 1.3.5
gzip2 1.0.2 1.0.3
GNU tar 1.14 1.15.1
Perl 5.6.1 5.8.8
jar, or InfoZIP ?
GMP Library 4.3.2 No
MPFR Library 2.4.2 No
MPC Library 0.8.1 No

So the GMP, MPFR and MPC support libraries need to build before install gcc. Also note from http://gcc.gnu.org/install/prerequisites.html “While any sufficiently new version of required tools usually work, library requirements are generally stricter. Newer versions may work in some cases, but it's safer to use the exact versions documented”

build GMP

Download the GMP source code

$ cd ~/scratch #or cd /tmp/$USER if luster is mis behaving ..
$ wget http://ftp.gnu.org/gnu/gmp/gmp-4.2.2.tar.bz2  

Testing

$ make -k check

Trouble Shooting

The compilation process may be unstable, requiring make to be run multiple times. If you experience such errors try

$ make && sleep 10 && make && sleep 10 && make

xgcc: internal compiler error: Killed (program cc1)

This error occurs when the cc1 process is killed/terminated. There could be many reasons for termination, not enough system recourses, another process killed cc1 (try killall cc1 from another shell, while make is running to replicate this error…)

This is a rather annoying error, but just keep running make until all the file are compiled.

gcj: internal compiler error: Killed (program jc1)

Again just as with xgcc error, the gcj program was killed/terminated. run make again

/app/dokuwiki/data/attic/guide/compiling_gcc.1322378795.txt.gz · Last modified: 2021/12/09 16:42 (external edit)