Lines Matching +full:clang +full:- +full:tools +full:- +full:extra
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
5 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6 <title>Clang - Getting Started</title>
12 <!--#include virtual="menu.html.incl"-->
16 <h1>Getting Started: Building and Running Clang</h1>
18 <p>This page gives you the shortest path to checking out Clang and demos a few
21 involved</a> with the Clang community. If you run into problems, please file
24 <h2 id="download">Release Clang Versions</h2>
26 <p>Clang is released as part of regular LLVM releases. You can download the release versions from <…
27 <p>Clang is also provided in all major BSD or GNU/Linux distributions as part of their respective p…
29 <h2 id="build">Building Clang and Working with the Code</h2>
31 <h3 id="buildNix">On Unix-like Systems</h3>
33 <p>If you would like to check out and build Clang, the current procedure is as
37 <li>Get the required tools.
41 Getting Started with the LLVM System - Requirements</a>.</li>
53 <li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
56 <li>Check out Clang:
58 <li><tt>cd llvm/tools</tt></li>
59 <li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
63 <li>Check out extra Clang tools: (optional)
65 <li><tt>cd llvm/tools/clang/tools</tt></li>
66 <li><tt>svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk
67 extra</tt></li>
71 <li>Check out Compiler-RT (optional):
74 <li><tt>svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk
75 compiler-rt</tt></li>
79 …<li>Check out libcxx: (only required to build and run Compiler-RT tests on OS X, optional otherwis…
82 <li><tt>svn co http://llvm.org/svn/llvm-project/libcxx/trunk
87 <li>Build LLVM and Clang:
89 <li><tt>mkdir build</tt> (in-tree build is not supported)</li>
91 <li><tt>cmake -G "Unix Makefiles" ../llvm</tt></li>
93 <li>This builds both LLVM and Clang for debug mode.</li>
94 <li>Note: For subsequent Clang development, you can just run
95 <tt>make clang</tt>.</li>
97 Eclipse CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator),
104 <li>If you intend to use Clang's C++ support, you may need to tell it how
105 to find your C++ standard library headers. In general, Clang will detect
106 the best version of libstdc++ headers available and use them - it will
108 adjacent to Clang itself. If your configuration fits neither of these
109 scenarios, you can use the <tt>-DGCC_INSTALL_PREFIX</tt> cmake option
110 to tell Clang where the gcc containing the desired libstdc++ is installed.
114 <li><tt>clang --help</tt></li>
115 <li><tt>clang file.c -fsyntax-only</tt> (check for correctness)</li>
116 <li><tt>clang file.c -S -emit-llvm -o -</tt> (print out unoptimized llvm code)</li>
117 <li><tt>clang file.c -S -emit-llvm -o - -O3</tt></li>
118 <li><tt>clang file.c -S -O3 -o -</tt> (output native machine code)</li>
123 <p>If you encounter problems while building Clang, make sure that your LLVM
124 checkout is at the same revision as your Clang checkout. LLVM's interfaces
128 <h3>Simultaneously Building Clang and LLVM:</h3>
130 <p>Once you have checked out Clang into the llvm source tree it will build along
131 with the rest of <tt>llvm</tt>. To build all of LLVM and Clang together all at
134 <p><em>Note:</em> Observe that Clang is technically part of a separate
135 Subversion repository. As mentioned above, the latest Clang sources are tied to
143 <p>The following details setting up for and building Clang on Windows using
147 <li>Get the required tools:
158 (which is essential, if you will be developing for clang).
162 <li><b>GnuWin32 tools</b>
165 because of embedded double-quotes in the search strings. The GNU
174 <li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
177 <li>Check out Clang:
179 <li><tt>cd llvm\tools</tt>
180 <li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
182 <p><em>Note</em>: Some Clang tests are sensitive to the line endings. Ensure
184 If you use git-svn, make sure your <tt>core.autocrlf</tt> setting is false.</p>
191 <li>If you are using Visual Studio 2013: <tt>cmake -G "Visual Studio 12" ..\llvm</tt></li>
198 <li>Build Clang:
201 <li>Build the "clang" project for just the compiler driver and front end, or
202 the "ALL_BUILD" project to build everything, including tools.</li>
208 Hacking on clang - Testing using Visual Studio on Windows</a> for information
212 <p>Note that once you have checked out both llvm and clang, to synchronize
214 llvm and llvm\tools\clang directories, as they are separate repositories.</p>
216 <h2 id="driver">Clang Compiler Driver (Drop-in Substitute for GCC)</h2>
218 <p>The <tt>clang</tt> tool is the compiler driver and front-end, which is
219 designed to be a drop-in replacement for the <tt>gcc</tt> command. Here are
220 some examples of how to use the high-level driver:
227 $ <b>clang t.c</b>
232 <p>The 'clang' driver is designed to work as closely to GCC as possible to
234 Clang defaults to gnu99 mode while GCC defaults to gnu89 mode. If you see
235 weird link-time errors relating to inline functions, try passing -std=gnu89
236 to clang.</p>
238 <h2>Examples of using Clang</h2>
240 <!-- Thanks to
241 http://shiflett.org/blog/2006/oct/formatting-and-highlighting-php-code-listings
243 tag. -->
255 $ <b>clang ~/t.c -E</b>
267 $ <b>clang -fsyntax-only ~/t.c</b>
274 $ <b>clang -fsyntax-only ~/t.c -pedantic</b>
284 <p>Note, the <tt>-cc1</tt> argument indicates the compiler front-end, and
285 not the driver, should be run. The compiler front-end has several additional
286 Clang specific features which are not exposed through the GCC compatible driver
290 $ <b>clang -cc1 ~/t.c -ast-print</b>
301 $ <b>clang ~/t.c -S -emit-llvm -o -</b>
308 $ <b>clang -fomit-frame-pointer -O3 -S -o - t.c</b> <i># On x86_64</i>