Lines Matching +full:docs +full:- +full:clang +full:- +full:tools +full:- +full:html

1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
3 <html>
5 <META http-equiv="Content-Type" content="text/html; charset=utf-8">
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
20 If you like what you see, please consider <a href="get_involved.html">getting
21 involved</a> with the Clang community. If you run into problems, please file
22 bugs on <a href="https://github.com/llvm/llvm-project/issues">the LLVM bug tracker</a>.</p>
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.
40 <a href="https://llvm.org/docs/GettingStarted.html#requirements">
41 Getting Started with the LLVM System - Requirements</a>.</li>
53 <li><tt>git clone https://github.com/llvm/llvm-project.git</tt></li>
56 …<li><tt>git clone --depth=1 https://github.com/llvm/llvm-project.git (using this only the latest v…
59 <li><tt>cd llvm-project</tt></li>
60 <li><tt>git fetch --unshallow</tt></li>
67 <li>Build LLVM and Clang:
69 <li><tt>cd llvm-project</tt></li>
70 <li><tt>mkdir build</tt> (in-tree build is not supported)</li>
72 <li>This builds both LLVM and Clang in release mode. Alternatively, if
74 …<a href="https://llvm.org/docs/CMake.html#frequently-used-cmake-variables">frequently used cmake v…
77 …<li><tt>cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm<…
79 <li>Note: For subsequent Clang development, you can just run
80 <tt>make clang</tt>.</li>
82 Eclipse CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator),
84 <a href="https://llvm.org/docs/CMake.html">Building LLVM with CMake</a>
90 libstdc++.so</tt>) and libstdc++ headers. In general, Clang will detect
91 well-known GCC installation paths matching the target triple (configured at
92 build time (see <tt>clang --version</tt>); overriden by
93 <tt>--target=</tt>) and use the largest version. If your configuration fits
94 none of the standard scenarios, you can set <tt>--gcc-install-dir=</tt> to
98 <tt>--gcc-triple=$triple</tt>.
102 <li><tt>clang --help</tt></li>
103 <li><tt>clang file.c -fsyntax-only</tt> (check for correctness)</li>
104 <li><tt>clang file.c -S -emit-llvm -o -</tt> (print out unoptimized llvm code)</li>
105 <li><tt>clang file.c -S -emit-llvm -o - -O3</tt></li>
106 <li><tt>clang file.c -S -O3 -o -</tt> (output native machine code)</li>
111 <li><tt>make check-clang</tt></li>
118 <p>The following details setting up for and building Clang on Windows using
122 <li>Get the required tools:
125 <a href="https://git-scm.com/download">
126 https://git-scm.com/download</a></li>
132 <li><b>Python</b>. It is used to run the clang test suite. Get it from:
135 <li><b>GnuWin32 tools</b>
136 The Clang and LLVM test suite use various GNU core utilities, such as
138 are the oldest and most well-tested way to get these tools. However, the
147 <li>Check out LLVM and Clang:
149 <li><tt>git clone https://github.com/llvm/llvm-project.git</tt></li>
151 <p><em>Note</em>: Some Clang tests are sensitive to the line endings. Ensure
158 <li><tt>cd llvm-project</tt></li>
163 …<tt>cmake -DLLVM_ENABLE_PROJECTS=clang -G "Visual Studio 16 2019" -A x64 -Thost=x64 ..\llvm</tt><b…
164 <tt>-Thost=x64</tt> is required, since the 32-bit linker will run out of memory.
166 <li>To generate x86 binaries instead of x64, pass <tt>-A Win32</tt>.</li>
167 <li>See the <a href="https://www.llvm.org/docs/CMake.html">LLVM CMake guide</a> for
173 <li>Build Clang:
176 <li>Build the "clang" project for just the compiler driver and front end, or
177 the "ALL_BUILD" project to build everything, including tools.</li>
182 <li>See <a href="hacking.html#testingWindows">
183 Hacking on clang - Testing using Visual Studio on Windows</a> for information
190 <a href="https://ninja-build.org/">Ninja build system</a>. You can use the
191 generated Visual Studio project files to edit Clang source code and generate a
195 <li>Check out clang and LLVM as described above</li>
200 tools, choose the one titled "x64 Native Tools Command Prompt for VS
203 appropriate vcvarsall.bat incantation. To get the 2017 x64 tools, this
216 <li><tt>cmake -GNinja -DLLVM_ENABLE_PROJECTS=clang ..\llvm</tt></li>
217 <li><tt>ninja clang</tt> This will build just clang.</li>
218 <li><tt>ninja check-clang</tt> This will run the clang tests.</li>
221 <h2 id="driver">Clang Compiler Driver (Drop-in Substitute for GCC)</h2>
223 <p>The <tt>clang</tt> tool is the compiler driver and front-end, which is
224 designed to be a drop-in replacement for the <tt>gcc</tt> command. Here are
225 some examples of how to use the high-level driver:
232 $ <b>clang t.c</b>
237 <p>The 'clang' driver is designed to work as closely to GCC as possible to
239 Clang defaults to gnu99 mode while GCC defaults to gnu89 mode. If you see
240 weird link-time errors relating to inline functions, try passing -std=gnu89
241 to clang.</p>
243 <h2>Examples of using Clang</h2>
245 <!-- Thanks to
246 http://shiflett.org/blog/2006/oct/formatting-and-highlighting-php-code-listings
248 tag. -->
260 $ <b>clang ~/t.c -E</b>
272 $ <b>clang -fsyntax-only ~/t.c</b>
279 $ <b>clang -fsyntax-only ~/t.c -pedantic</b>
289 <p>Note, the <tt>-cc1</tt> argument indicates the compiler front-end, and
290 not the driver, should be run. The compiler front-end has several additional
291 Clang specific features which are not exposed through the GCC compatible driver
295 $ <b>clang -cc1 ~/t.c -ast-print</b>
306 $ <b>clang ~/t.c -S -emit-llvm -o -</b>
313 $ <b>clang -fomit-frame-pointer -O3 -S -o - t.c</b> <i># On x86_64</i>
325 </html>