Quotes should be printed before private prefix; some code clean up.
[llvm/msp430.git] / docs / GCCFEBuildInstrs.html
blob262c16783947eb7dcb038adada601d49e3ff9c4a
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6 <link rel="stylesheet" href="llvm.css" type="text/css" media="screen">
7 <title>Building the LLVM GCC Front-End</title>
8 </head>
9 <body>
11 <div class="doc_title">
12 Building the LLVM GCC Front-End
13 </div>
15 <ol>
16 <li><a href="#instructions">Building llvm-gcc from Source</a></li>
17 <li><a href="#ada">Building the Ada front-end</a></li>
18 <li><a href="#fortran">Building the Fortran front-end</a></li>
19 <li><a href="#license">License Information</a></li>
20 </ol>
22 <div class="doc_author">
23 <p>Written by the LLVM Team</p>
24 </div>
26 <!-- *********************************************************************** -->
27 <h1><a name="instructions">Building llvm-gcc from Source</a></h1>
28 <!-- *********************************************************************** -->
30 <div class="doc_text">
32 <p>This section describes how to acquire and build llvm-gcc 4.2, which is based
33 on the GCC 4.2.1 front-end. Supported languages are Ada, C, C++, Fortran,
34 Objective-C and Objective-C++. Note that the instructions for building these
35 front-ends are completely different (and much easier!) than those for building
36 llvm-gcc3 in the past.</p>
38 <ol>
39 <li><p>Retrieve the appropriate llvm-gcc-4.2-<i>version</i>.source.tar.gz
40 archive from the <a href="http://llvm.org/releases/">LLVM web
41 site</a>.</p>
43 <p>It is also possible to download the sources of the llvm-gcc front end
44 from a read-only mirror using subversion. To check out the 4.2 code
45 for first time use:</p>
47 <div class="doc_code">
48 <pre>
49 svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk <i>dst-directory</i>
50 </pre>
51 </div>
53 <p>After that, the code can be be updated in the destination directory
54 using:</p>
56 <div class="doc_code">
57 <pre>svn update</pre>
58 </div>
60 <p>The mirror is brought up to date every evening.</p></li>
62 <li>Follow the directions in the top-level <tt>README.LLVM</tt> file for
63 up-to-date instructions on how to build llvm-gcc. See below for building
64 with support for Ada or Fortran.
65 </ol>
67 </div>
69 <!-- *********************************************************************** -->
70 <h1><a name="ada">Building the Ada front-end</a></h1>
71 <!-- *********************************************************************** -->
73 <div class="doc_text">
74 <p>Building with support for Ada amounts to following the directions in the
75 top-level <tt>README.LLVM</tt> file, adding ",ada" to EXTRALANGS, for example:
76 <tt>EXTRALANGS=,ada</tt></p>
78 <p>There are some complications however:</p>
80 <ol>
81 <li><p>The only platform for which the Ada front-end is known to build is
82 32 bit intel x86 running linux. It is unlikely to build for other
83 systems without some work.</p></li>
84 <li><p>The build requires having a compiler that supports Ada, C and C++.
85 The Ada front-end is written in Ada so an Ada compiler is needed to
86 build it. Compilers known to work with the
87 <a href="http://llvm.org/releases/download.html">LLVM 2.5 release</a>
88 are <a href="http://gcc.gnu.org/releases.html">gcc-4.2</a> and the
89 2005, 2006 and 2007 versions of the
90 <a href="http://libre.adacore.com/">GNAT GPL Edition</a>.
91 The LLVM parts of llvm-gcc are written in C++ so a C++ compiler is
92 needed to build them. The rest of gcc is written in C.
93 Some linux distributions provide a version of gcc that supports all
94 three languages (the Ada part often comes as an add-on package to
95 the rest of gcc). Otherwise it is possible to combine two versions
96 of gcc, one that supports Ada and C (such as the
97 <a href="http://libre.adacore.com/">2007 GNAT GPL Edition</a>)
98 and another which supports C++, see below.</p></li>
99 <li><p>Because the Ada front-end is experimental, it is wise to build the
100 compiler with checking enabled. This causes it to run much slower, but
101 helps catch mistakes in the compiler (please report any problems using
102 <a href="http://llvm.org/bugs">LLVM bugzilla</a>).</p></li>
103 <li><p>The Ada front-end <a href="http://llvm.org/PR2007">fails to
104 bootstrap</a>, due to lack of LLVM support for
105 <tt>setjmp</tt>/<tt>longjmp</tt> style exception handling (used
106 internally by the compiler), so you must specify
107 <tt>--disable-bootstrap</tt>.</p></li>
108 </ol>
110 <p>Supposing appropriate compilers are available, llvm-gcc with Ada support can
111 be built on an x86-32 linux box using the following recipe:</p>
113 <ol>
114 <li><p>Download the <a href="http://llvm.org/releases/download.html">LLVM source</a>
115 and unpack it:</p>
117 <pre class="doc_code">
118 wget http://llvm.org/releases/2.5/llvm-2.5.tar.gz
119 tar xzf llvm-2.5.tar.gz
120 mv llvm-2.5 llvm
121 </pre>
123 <p>or <a href="GettingStarted.html#checkout">check out the
124 latest version from subversion</a>:</p>
126 <pre class="doc_code">svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</pre>
128 </li>
130 <li><p>Download the
131 <a href="http://llvm.org/releases/download.html">llvm-gcc-4.2 source</a>
132 and unpack it:</p>
134 <pre class="doc_code">
135 wget http://llvm.org/releases/2.5/llvm-gcc-4.2-2.5.source.tar.gz
136 tar xzf llvm-gcc-4.2-2.5.source.tar.gz
137 mv llvm-gcc4.2-2.5.source llvm-gcc-4.2
138 </pre>
140 <p>or <a href="GettingStarted.html#checkout">check out the
141 latest version from subversion</a>:</p>
143 <pre class="doc_code">
144 svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk llvm-gcc-4.2
145 </pre>
146 </li>
148 <li><p>Make a build directory <tt>llvm-objects</tt> for llvm and make it the
149 current directory:</p>
151 <pre class="doc_code">
152 mkdir llvm-objects
153 cd llvm-objects
154 </pre>
155 </li>
157 <li><p>Configure LLVM (here it is configured to install into <tt>/usr/local</tt>):</p>
159 <pre class="doc_code">
160 ../llvm/configure --prefix=<b>/usr/local</b> --enable-optimized --enable-assertions
161 </pre>
163 <p>If you have a multi-compiler setup and the C++ compiler is not the
164 default, then you can configure like this:</p>
166 <pre class="doc_code">
167 CXX=<b>PATH_TO_C++_COMPILER</b> ../llvm/configure --prefix=<b>/usr/local</b> --enable-optimized --enable-assertions
168 </pre>
170 <p>To compile without checking (not recommended), replace
171 <tt>--enable-assertions</tt> with <tt>--disable-assertions</tt>.</p>
173 </li>
175 <li><p>Build LLVM:</p>
177 <pre class="doc_code">
178 make
179 </pre>
180 </li>
182 <li><p>Install LLVM (optional):</p>
184 <pre class="doc_code">
185 make install
186 </pre>
187 </li>
189 <li><p>Make a build directory <tt>llvm-gcc-4.2-objects</tt> for llvm-gcc and make it the
190 current directory:</p>
192 <pre class="doc_code">
193 cd ..
194 mkdir llvm-gcc-4.2-objects
195 cd llvm-gcc-4.2-objects
196 </pre>
197 </li>
199 <li><p>Configure llvm-gcc (here it is configured to install into <tt>/usr/local</tt>).
200 The <tt>--enable-checking</tt> flag turns on sanity checks inside the compiler.
201 To turn off these checks (not recommended), replace <tt>--enable-checking</tt>
202 with <tt>--disable-checking</tt>.
203 Additional languages can be appended to the <tt>--enable-languages</tt> switch,
204 for example <tt>--enable-languages=ada,c,c++</tt>.</p>
206 <pre class="doc_code">
207 ../llvm-gcc-4.2/configure --prefix=<b>/usr/local</b> --enable-languages=ada,c \
208 --enable-checking --enable-llvm=$PWD/../llvm-objects \
209 --disable-bootstrap --disable-multilib
210 </pre>
212 <p>If you have a multi-compiler setup, then you can configure like this:</p>
214 <pre class="doc_code">
215 export CC=<b>PATH_TO_C_AND_ADA_COMPILER</b>
216 export CXX=<b>PATH_TO_C++_COMPILER</b>
217 ../llvm-gcc-4.2/configure --prefix=<b>/usr/local</b> --enable-languages=ada,c \
218 --enable-checking --enable-llvm=$PWD/../llvm-objects \
219 --disable-bootstrap --disable-multilib
220 </pre>
221 </li>
223 <li><p>Build and install the compiler:</p>
225 <pre class="doc_code">
226 make
227 make install
228 </pre>
229 </li>
230 </ol>
232 </div>
234 <!-- *********************************************************************** -->
235 <h1><a name="fortran">Building the Fortran front-end</a></h1>
236 <!-- *********************************************************************** -->
238 <div class="doc_text">
239 <p>To build with support for Fortran, follow the directions in the top-level
240 <tt>README.LLVM</tt> file, adding ",fortran" to EXTRALANGS, for example:</p>
242 <pre class="doc_code">
243 EXTRALANGS=,fortran
244 </pre>
246 </div>
248 <!-- *********************************************************************** -->
249 <h1><a name="license">License Information</a></h1>
250 <!-- *********************************************************************** -->
252 <div class="doc_text">
254 The LLVM GCC frontend is licensed to you under the GNU General Public License
255 and the GNU Lesser General Public License. Please see the files COPYING and
256 COPYING.LIB for more details.
257 </p>
260 More information is <a href="FAQ.html#license">available in the FAQ</a>.
261 </p>
262 </div>
264 <!-- *********************************************************************** -->
266 <hr>
267 <address>
268 <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
269 src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
270 <a href="http://validator.w3.org/check/referer"><img
271 src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
273 <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
274 Last modified: $Date$
275 </address>
277 </body>
278 </html>