2004-05-12 18:49:47 +00:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
|
"http://www.w3.org/TR/html4/strict.dtd">
|
2003-10-23 01:48:33 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2004-05-12 18:49:47 +00:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
|
<link rel="stylesheet" href="llvm.css" type="text/css" media="screen">
|
2007-02-14 07:42:12 +00:00
|
|
|
<title>Building the LLVM C/C++ Front-End</title>
|
2003-10-23 01:48:33 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div class="doc_title">
|
2008-02-12 21:22:58 +00:00
|
|
|
Building the LLVM GCC Front-End
|
2003-10-23 01:48:33 +00:00
|
|
|
</div>
|
2003-10-21 21:58:38 +00:00
|
|
|
|
2003-11-12 20:47:30 +00:00
|
|
|
<ol>
|
2008-02-12 21:22:58 +00:00
|
|
|
<li><a href="#instructions">Building llvm-gcc from Source</a></li>
|
2004-06-01 18:13:05 +00:00
|
|
|
<li><a href="#license">License Information</a></li>
|
2003-11-12 20:47:30 +00:00
|
|
|
</ol>
|
|
|
|
|
2004-05-23 21:07:27 +00:00
|
|
|
<div class="doc_author">
|
2007-02-14 07:42:12 +00:00
|
|
|
<p>Written by the LLVM Team</p>
|
2003-11-12 20:47:30 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- *********************************************************************** -->
|
|
|
|
<div class="doc_section">
|
2008-02-12 21:22:58 +00:00
|
|
|
<a name="instructions">Building llvm-gcc from Source</a>
|
2003-10-23 01:48:33 +00:00
|
|
|
</div>
|
|
|
|
<!-- *********************************************************************** -->
|
|
|
|
|
|
|
|
<div class="doc_text">
|
2006-07-11 20:47:00 +00:00
|
|
|
|
2008-02-12 21:22:58 +00:00
|
|
|
<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
|
2007-02-14 07:42:12 +00:00
|
|
|
the past.</p>
|
2006-07-11 20:47:00 +00:00
|
|
|
|
2003-10-21 21:58:38 +00:00
|
|
|
<ol>
|
2008-02-12 21:22:58 +00:00
|
|
|
<li><p>Retrieve the appropriate llvm-gcc4.x-y.z.source.tar.gz archive from the
|
2007-02-14 07:42:12 +00:00
|
|
|
<a href="http://llvm.org/releases/">llvm web site</a>.</p>
|
2006-06-16 23:34:49 +00:00
|
|
|
|
2008-02-12 21:22:58 +00:00
|
|
|
<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>
|
2006-06-16 23:34:49 +00:00
|
|
|
|
2006-11-16 09:31:19 +00:00
|
|
|
<div class="doc_code">
|
|
|
|
<pre>
|
2007-07-23 03:56:42 +00:00
|
|
|
svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.0/trunk <i>dst-directory</i>
|
2006-11-16 09:31:19 +00:00
|
|
|
</pre>
|
2008-02-12 21:22:58 +00:00
|
|
|
</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>
|
2006-11-16 09:31:19 +00:00
|
|
|
</div>
|
2006-06-16 23:34:49 +00:00
|
|
|
|
2006-11-16 09:31:19 +00:00
|
|
|
<p>After that, the code can be be updated in the destination directory
|
|
|
|
using:</p>
|
|
|
|
|
|
|
|
<div class="doc_code">
|
|
|
|
<pre>svn update</pre>
|
|
|
|
</div>
|
2006-06-16 23:34:49 +00:00
|
|
|
|
2006-11-16 09:31:19 +00:00
|
|
|
<p>The mirror is brought up to date every evening.</p></li>
|
2006-07-11 20:47:00 +00:00
|
|
|
|
2006-11-16 09:31:19 +00:00
|
|
|
<li>Follow the directions in the top-level <tt>README.LLVM</tt> file for
|
2008-02-12 21:22:58 +00:00
|
|
|
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>
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>The only platform for which the Ada front-end is known to build is
|
2008-02-12 21:22:58 +00:00
|
|
|
32 bit intel x86 running linux. It is unlikely to build for other
|
2008-02-12 21:28:39 +00:00
|
|
|
systems without some work.</p></li>
|
|
|
|
<li><p>The build requires having a compiler that supports Ada, C and C++.
|
2008-02-12 21:22:58 +00:00
|
|
|
The Ada front-end is written in Ada so an Ada compiler is needed to
|
2008-02-13 16:46:10 +00:00
|
|
|
build it. What is more, the Ada compiler must not be more recent
|
|
|
|
than what it is trying to compile, otherwise the build will fail.
|
|
|
|
This rules out gcc-4.3 (but not gcc-4.2) and also the
|
|
|
|
<a href="http://libre.adacore.com/">2007 GNAT GPL Edition</a>.
|
|
|
|
The LLVM parts of llvm-gcc are written in C++ so a C++
|
2008-02-12 21:22:58 +00:00
|
|
|
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
|
2008-02-13 16:46:10 +00:00
|
|
|
of gcc, one that supports Ada and C (such as the
|
|
|
|
<a href="http://libre.adacore.com/">2006 GNAT GPL Edition</a>)
|
|
|
|
and another which supports C++, see below.</p></li>
|
|
|
|
<li><p>Because the Ada front-end is experimental, it is wise to build the
|
|
|
|
compiler with checking enabled. This causes it to run slower, but
|
|
|
|
helps catch mistakes in the compiler (please report any problems using
|
|
|
|
<a href="http://llvm.org/bugs">LLVM bugzilla</a>).</p></li>
|
2008-02-12 21:22:58 +00:00
|
|
|
</ol>
|
|
|
|
|
|
|
|
<p>Supposing appropriate compilers are available, llvm-gcc with Ada support can
|
2008-02-12 21:40:21 +00:00
|
|
|
be built on an x86-32 linux box using the following recipe:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<ol>
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>Download the <a href="http://llvm.org/releases/download.html">LLVM source</a>
|
|
|
|
and unpack it:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<p>or <a href="http://llvm.org/docs/GettingStarted.html#checkout">check out the
|
|
|
|
latest version from subversion</a>:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
|
|
|
<pre>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</pre>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>Download the
|
2008-02-12 21:22:58 +00:00
|
|
|
<a href="http://llvm.org/releases/download.html">llvm-gcc-4.2 source</a>
|
2008-02-12 21:28:39 +00:00
|
|
|
and unpack it:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<p>or <a href="http://llvm.org/docs/GettingStarted.html#checkout">check out the
|
|
|
|
latest version from subversion</a>:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>Make a build directory <tt>llvm-objects</tt> for llvm and make it the
|
|
|
|
current directory:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
|
|
|
<pre>mkdir llvm-objects
|
|
|
|
cd llvm-objects</pre>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>Configure LLVM (here it is configured to install into <tt>/usr/local</tt>):</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
2008-02-13 16:46:10 +00:00
|
|
|
<pre>../llvm/configure --prefix=<b>/usr/local</b></pre>
|
2008-02-12 21:22:58 +00:00
|
|
|
</div>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<p>If you have a multi-compiler setup and the C++ compiler is not the
|
|
|
|
default, then you can configure like this:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
2008-02-13 16:46:10 +00:00
|
|
|
<pre>CXX=<b>PATH_TO_C++_COMPILER</b> ../llvm/configure --prefix=<b>/usr/local</b></pre>
|
2008-02-12 21:22:58 +00:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
2008-02-13 16:46:10 +00:00
|
|
|
<li><p>Build LLVM with checking enabled (use <tt>ENABLE_OPTIMIZED=1</tt> to
|
|
|
|
build without checking):</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
2008-02-13 16:46:10 +00:00
|
|
|
<pre>make ENABLE_OPTIMIZED=0</pre>
|
2008-02-12 21:22:58 +00:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>Install LLVM (optional):</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
|
|
|
<pre>make install</pre>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>Make a build directory <tt>llvm-gcc-4.2-objects</tt> for llvm-gcc and make it the
|
|
|
|
current directory:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
|
|
|
<pre>
|
|
|
|
cd ..
|
|
|
|
mkdir llvm-gcc-4.2-objects
|
|
|
|
cd llvm-gcc-4.2-objects</pre>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>Configure llvm-gcc (here it is configured to install into <tt>/usr/local</tt>).
|
2008-02-13 16:46:10 +00:00
|
|
|
The <tt>--enable-checking</tt> flag turns on sanity checks inside the compiler.
|
|
|
|
If you omit it then LLVM must be built with <tt>make ENABLE_OPTIMIZED=1</tt>.
|
2008-02-12 21:22:58 +00:00
|
|
|
Additional languages can be appended to the --enable-languages switch,
|
2008-02-12 21:28:39 +00:00
|
|
|
for example <tt>--enable-languages=ada,c,c++</tt>.</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
2008-02-13 16:46:10 +00:00
|
|
|
<pre>../llvm-gcc-4.2/configure --prefix=<b>/usr/local</b> --enable-languages=ada,c --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-shared --disable-bootstrap --disable-multilib</pre>
|
2008-02-12 21:22:58 +00:00
|
|
|
</div>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<p>If you have a multi-compiler setup, then you can configure like this:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
<div class="doc_code">
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
export CC=<b>PATH_TO_C_AND_ADA_COMPILER</b>
|
|
|
|
export CXX=<b>PATH_TO_C++_COMPILER</b>
|
2008-02-13 16:46:10 +00:00
|
|
|
../llvm-gcc-4.2/configure --prefix=<b>/usr/local</b> --enable-languages=ada,c --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-shared --disable-bootstrap --disable-multilib</pre>
|
2008-02-12 21:22:58 +00:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
2008-02-12 21:28:39 +00:00
|
|
|
<li><p>Build and install the compiler:</p>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<div class="doc_code">
|
|
|
|
<pre>make
|
|
|
|
make install</pre>
|
|
|
|
</div>
|
|
|
|
</li>
|
2006-07-11 20:47:00 +00:00
|
|
|
</ol>
|
2006-11-16 09:31:19 +00:00
|
|
|
|
2006-07-11 20:47:00 +00:00
|
|
|
</div>
|
2008-02-12 21:22:58 +00:00
|
|
|
|
|
|
|
<!-- *********************************************************************** -->
|
|
|
|
<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>
|
|
|
|
|
2003-12-18 16:43:17 +00:00
|
|
|
<!-- *********************************************************************** -->
|
|
|
|
<div class="doc_section">
|
|
|
|
<a name="license">License Information</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="doc_text">
|
|
|
|
<p>
|
|
|
|
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.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2006-07-11 20:47:00 +00:00
|
|
|
More information is <a href="FAQ.html#license">available in the FAQ</a>.
|
2003-12-18 16:43:17 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2003-10-21 21:58:38 +00:00
|
|
|
<!-- *********************************************************************** -->
|
|
|
|
|
2003-10-28 21:09:29 +00:00
|
|
|
<hr>
|
2004-05-12 18:49:47 +00:00
|
|
|
<address>
|
|
|
|
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
|
|
|
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
|
|
|
|
<a href="http://validator.w3.org/check/referer"><img
|
|
|
|
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
|
|
|
|
|
2006-03-14 05:39:39 +00:00
|
|
|
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
2003-10-28 21:09:29 +00:00
|
|
|
Last modified: $Date$
|
2004-05-12 18:49:47 +00:00
|
|
|
</address>
|
2003-10-21 21:58:38 +00:00
|
|
|
|
2003-10-23 01:48:33 +00:00
|
|
|
</body>
|
|
|
|
</html>
|