This section describes how to acquire and build llvm-gcc 4.0 and 4.2, which are based on the GCC 4.0.1/4.2.1 front-ends respectively. Both front-ends support C, C++, Objective-C and Objective-C++. The 4.2 front-end also supports Ada and Fortran to some extent. Note that the instructions for building these front-ends are completely different (and much easier!) than those for building llvm-gcc3 in the past.
Retrieve the appropriate llvm-gcc4.x-y.z.source.tar.gz archive from the llvm web site.
It is also possible to download the sources of the llvm-gcc front end from a read-only mirror using subversion. To check out the 4.0 code for first time use:
svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.0/trunk dst-directory
To check out the 4.2 code use:
svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk dst-directory
After that, the code can be be updated in the destination directory using:
svn update
The mirror is brought up to date every evening.
Building with support for Ada amounts to following the directions in the top-level README.LLVM file, adding ",ada" to EXTRALANGS, for example: EXTRALANGS=,ada
There are some complications however:
Supposing appropriate compilers are available, llvm-gcc with Ada support can be built using the following recipe:
wget http://llvm.org/releases/2.2/llvm-2.2.tar.gz tar xzf llvm-2.2.tar.gz mv llvm-2.2 llvm
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
wget http://llvm.org/releases/2.2/llvm-gcc4.2-2.2.source.tar.gz tar xzf llvm-gcc4.2-2.2.source.tar.gz mv llvm-gcc4.2-2.2.source llvm-gcc-4.2
svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk llvm-gcc-4.2
mkdir llvm-objects cd llvm-objects
../llvm/configure --prefix=/usr/local
CXX=PATH_TO_C++_COMPILER ../llvm/configure --prefix=/usr/local
make
make install
cd .. mkdir llvm-gcc-4.2-objects cd llvm-gcc-4.2-objects
../llvm-gcc-4.2/configure --prefix=/usr/local --enable-languages=ada,c --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-shared --disable-bootstrap --disable-multilib
export CC=PATH_TO_C_AND_ADA_COMPILER export CXX=PATH_TO_C++_COMPILER ../llvm-gcc-4.2/configure --prefix=/usr/local --enable-languages=ada,c --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-shared --disable-bootstrap --disable-multilib
make make install
To build with support for Fortran, follow the directions in the top-level README.LLVM file, adding ",fortran" to EXTRALANGS, for example:
EXTRALANGS=,fortran
The LLVM GCC frontend is licensed to you under the GNU General Public License and the GNU Lesser General Public License. Please see the files COPYING and COPYING.LIB for more details.
More information is available in the FAQ.