Add instructions for building Ada and Fortran.

Adjust mentions of gcc4 to be 4.0/4.2 agnostic.
This file should probably be renamed tor
 GCCFEBuildInstrs.html...

llvm-svn: 47027
This commit is contained in:
Duncan Sands 2008-02-12 21:22:58 +00:00
parent 274aa2846e
commit 8216baaed2

View File

@ -9,11 +9,11 @@
<body>
<div class="doc_title">
Building the LLVM C/C++ Front-End
Building the LLVM GCC Front-End
</div>
<ol>
<li><a href="#instructions">Building llvm-gcc 4 from Source</a></li>
<li><a href="#instructions">Building llvm-gcc from Source</a></li>
<li><a href="#license">License Information</a></li>
</ol>
@ -23,30 +23,39 @@
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="instructions">Building llvm-gcc 4 from Source</a>
<a name="instructions">Building llvm-gcc from Source</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This section describes how to aquire and build llvm-gcc4, which is based on
the GCC 4.0.1 front-end. This front-end supports C, C++, Objective-C, and
Objective-C++. Note that the instructions for building this front-end are
completely different (and much easier!) than those for building llvm-gcc3 in
<p>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.</p>
<ol>
<li><p>Retrieve the appropriate llvm-gcc4-x.y.source.tar.gz archive from the
<li><p>Retrieve the appropriate llvm-gcc4.x-y.z.source.tar.gz archive from the
<a href="http://llvm.org/releases/">llvm web site</a>.</p>
<p>It is also possible to download the sources of the llvm-gcc4 front end
from a read-only mirror using subversion. To check out the code the
first time use:</p>
<p>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:</p>
<div class="doc_code">
<pre>
svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.0/trunk <i>dst-directory</i>
</pre>
</div>
<p>To check out the 4.2 code use:</p>
<div class="doc_code">
<pre>
svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk <i>dst-directory</i>
</pre>
</div>
<p>After that, the code can be be updated in the destination directory
@ -59,10 +68,174 @@ svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.0/trunk <i>dst-directory</i>
<p>The mirror is brought up to date every evening.</p></li>
<li>Follow the directions in the top-level <tt>README.LLVM</tt> file for
up-to-date instructions on how to build llvm-gcc4.</li>
up-to-date instructions on how to build llvm-gcc. See below for building
with support for Ada or Fortran.
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="license">Building the Ada front-end</a>
</div>
<div class="doc_text">
<p>Building with support for Ada amounts to following the directions in the
top-level <tt>README.LLVM</tt> file, adding ",ada" to EXTRALANGS, for example:
<tt>EXTRALANGS=,ada</tt></p>
<p>There are some complications however:</p>
<ol>
<li>The only platform for which the Ada front-end is known to build is
32 bit intel x86 running linux. It is unlikely to build for other
systems without some work.</li>
<li>The build requires having a compiler that supports Ada, C and C++.
The Ada front-end is written in Ada so an Ada compiler is needed to
build it. The LLVM parts of llvm-gcc are written in C++ so a C++
compiler is needed to build them. The rest of gcc is written in C.
Some linux distributions provide a version of gcc that supports all
three languages (the Ada part often comes as an add-on package to
the rest of gcc). Otherwise it is possible to combine two versions
of gcc, one that supports Ada and C (such as
<a href="http://libre.adacore.com/">GNAT GPL Edition</a>) and another
which supports C++, see below.</li>
</ol>
<p>Supposing appropriate compilers are available, llvm-gcc with Ada support can
be built using the following recipe:</p>
<ol>
<li>Download the <a href="http://llvm.org/releases/download.html">LLVM source</a>
and unpack it:
<div class="doc_code">
<pre>wget http://llvm.org/releases/2.2/llvm-2.2.tar.gz
tar xzf llvm-2.2.tar.gz
mv llvm-2.2 llvm</pre>
</div>
or <a href="http://llvm.org/docs/GettingStarted.html#checkout">check out the
latest version from subversion</a>:
<div class="doc_code">
<pre>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</pre>
</div>
</li>
<li>Download the
<a href="http://llvm.org/releases/download.html">llvm-gcc-4.2 source</a>
and unpack it:
<div class="doc_code">
<pre>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</pre>
</div>
or <a href="http://llvm.org/docs/GettingStarted.html#checkout">check out the
latest version from subversion</a>:
<div class="doc_code">
<pre>svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk llvm-gcc-4.2</pre>
</div>
</li>
<li>Make a build directory <tt>llvm-objects</tt> for llvm and make it the
current directory:
<div class="doc_code">
<pre>mkdir llvm-objects
cd llvm-objects</pre>
</div>
</li>
<li>Configure LLVM (here it is configured to install into <tt>/usr/local</tt>):
<div class="doc_code">
<pre>../llvm/configure --prefix=/usr/local</pre>
</div>
If you have a multi-compiler setup and the C++ compiler is not the
default, then you can configure like this:
<div class="doc_code">
<pre>CXX=<b>PATH_TO_C++_COMPILER</b> ../llvm/configure --prefix=/usr/local</pre>
</div>
</li>
<li>Build LLVM:
<div class="doc_code">
<pre>make</pre>
</div>
</li>
<li>Install LLVM (optional):
<div class="doc_code">
<pre>make install</pre>
</div>
</li>
<li>Make a build directory <tt>llvm-gcc-4.2-objects</tt> for llvm-gcc and make it the
current directory:
<div class="doc_code">
<pre>
cd ..
mkdir llvm-gcc-4.2-objects
cd llvm-gcc-4.2-objects</pre>
</div>
</li>
<li>Configure llvm-gcc (here it is configured to install into <tt>/usr/local</tt>).
Additional languages can be appended to the --enable-languages switch,
for example <tt>--enable-languages=ada,c,c++</tt>.
<div class="doc_code">
<pre>../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</pre>
</div>
If you have a multi-compiler setup, then you can configure like this:
<div class="doc_code">
<pre>
export CC=<b>PATH_TO_C_AND_ADA_COMPILER</b>
export CXX=<b>PATH_TO_C++_COMPILER</b>
../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</pre>
</div>
</li>
<li>Build and install the compiler:
<div class="doc_code">
<pre>make
make install</pre>
</div>
</li>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="license">Building the Fortran front-end</a>
</div>
<div class="doc_text">
<p>
To build with support for Fortran, follow the directions in the top-level
<tt>README.LLVM</tt> file, adding ",fortran" to EXTRALANGS, for example:</p>
<div class="doc_code">
<pre>
EXTRALANGS=,fortran
</pre>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="license">License Information</a>