Lines Matching +full:check +full:- +full:clang +full:- +full:python
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
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
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
41 Getting Started with the LLVM System - Requirements</a>.</li>
42 <li>Note also that Python is needed for running the test suite.
43 Get it at: <a href="https://www.python.org/downloads/">
44 https://www.python.org/downloads/</a></li>
50 <li>Check out the LLVM project:
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),
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
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:
133 <a href="https://www.python.org/download/">
134 https://www.python.org/download/</a></li>
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>
173 <li>Build Clang:
176 <li>Build the "clang" project for just the compiler driver and front end, or
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>
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>