1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>How To Build On ARM — LLVM 13 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="How To Build Clang and LLVM with Profile-Guided Optimizations" href="HowToBuildWithPGO.html" />
<link rel="prev" title="The LLVM gold plugin" href="GoldPlugin.html" />
<style type="text/css">
table.right { float: right; margin-left: 20px; }
table.right td { border: 1px solid #ccc; }
</style>
</head><body>
<div class="logo">
<a href="index.html">
<img src="_static/logo.png"
alt="LLVM Logo" width="250" height="88"/></a>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="HowToBuildWithPGO.html" title="How To Build Clang and LLVM with Profile-Guided Optimizations"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="GoldPlugin.html" title="The LLVM gold plugin"
accesskey="P">previous</a> |</li>
<li><a href="https://llvm.org/">LLVM Home</a> | </li>
<li><a href="index.html">Documentation</a>»</li>
<li class="nav-item nav-item-1"><a href="UserGuides.html" accesskey="U">User Guides</a> »</li>
<li class="nav-item nav-item-this"><a href="">How To Build On ARM</a></li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3>Documentation</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/GettingStartedTutorials.html">Getting Started/Tutorials</a></li>
<li><a href="https://llvm.org/docs/UserGuides.html">User Guides</a></li>
<li><a href="https://llvm.org/docs/Reference.html">Reference</a></li>
</ul>
<h3>Getting Involved</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/Contributing.html">Contributing to LLVM</a></li>
<li><a href="https://llvm.org/docs/HowToSubmitABug.html">Submitting Bug Reports</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#mailing-lists">Mailing Lists</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#irc">IRC</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#meetups-and-social-events">Meetups and Social Events</a></li>
</ul>
<h3>Additional Links</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/FAQ.html">FAQ</a></li>
<li><a href="https://llvm.org/docs/Lexicon.html">Glossary</a></li>
<li><a href="https://llvm.org/pubs">Publications</a></li>
<li><a href="https://github.com/llvm/llvm-project//">Github Repository</a></li>
</ul>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/HowToBuildOnARM.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="how-to-build-on-arm">
<h1>How To Build On ARM<a class="headerlink" href="#how-to-build-on-arm" title="Permalink to this headline">¶</a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>This document contains information about building/testing LLVM and
Clang on an ARM machine.</p>
<p>This document is <em>NOT</em> tailored to help you cross-compile LLVM/Clang
to ARM on another architecture, for example an x86_64 machine. To find
out more about cross-compiling, please check <a class="reference internal" href="HowToCrossCompileLLVM.html"><span class="doc">How To Cross-Compile Clang/LLVM using Clang/LLVM</span></a>.</p>
</div>
<div class="section" id="notes-on-building-llvm-clang-on-arm">
<h2>Notes On Building LLVM/Clang on ARM<a class="headerlink" href="#notes-on-building-llvm-clang-on-arm" title="Permalink to this headline">¶</a></h2>
<p>Here are some notes on building/testing LLVM/Clang on ARM. Note that
ARM encompasses a wide variety of CPUs; this advice is primarily based
on the ARMv6 and ARMv7 architectures and may be inapplicable to older chips.</p>
<ol class="arabic">
<li><p>The most popular Linaro/Ubuntu OS’s for ARM boards, e.g., the
Pandaboard, have become hard-float platforms. There are a number of
choices when using CMake. Autoconf usage is deprecated as of 3.8.</p>
<p>Building LLVM/Clang in <code class="docutils literal notranslate"><span class="pre">Release</span></code> mode is preferred since it consumes
a lot less memory. Otherwise, the building process will very likely
fail due to insufficient memory. It’s also a lot quicker to only build
the relevant back-ends (ARM and AArch64), since it’s very unlikely that
you’ll use an ARM board to cross-compile to other arches. If you’re
running Compiler-RT tests, also include the x86 back-end, or some tests
will fail.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cmake <span class="nv">$LLVM_SRC_DIR</span> -DCMAKE_BUILD_TYPE<span class="o">=</span>Release <span class="se">\</span>
-DLLVM_TARGETS_TO_BUILD<span class="o">=</span><span class="s2">"ARM;X86;AArch64"</span>
</pre></div>
</div>
<p>Other options you can use are:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>Use Ninja instead of Make: <span class="s2">"-G Ninja"</span>
Build with assertions on: <span class="s2">"-DLLVM_ENABLE_ASSERTIONS=True"</span>
Local <span class="o">(</span>non-sudo<span class="o">)</span> install path: <span class="s2">"-DCMAKE_INSTALL_PREFIX=</span><span class="nv">$HOME</span><span class="s2">/llvm/install"</span>
CPU flags: <span class="s2">"DCMAKE_C_FLAGS=-mcpu=cortex-a15"</span> <span class="o">(</span>same <span class="k">for</span> CXX_FLAGS<span class="o">)</span>
</pre></div>
</div>
<p>After that, just typing <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">-jN</span></code> or <code class="docutils literal notranslate"><span class="pre">ninja</span></code> will build everything.
<code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">-jN</span> <span class="pre">check-all</span></code> or <code class="docutils literal notranslate"><span class="pre">ninja</span> <span class="pre">check-all</span></code> will run all compiler tests. For
running the test suite, please refer to <a class="reference internal" href="TestingGuide.html"><span class="doc">LLVM Testing Infrastructure Guide</span></a>.</p>
</li>
<li><p>If you are building LLVM/Clang on an ARM board with 1G of memory or less,
please use <code class="docutils literal notranslate"><span class="pre">gold</span></code> rather then GNU <code class="docutils literal notranslate"><span class="pre">ld</span></code>. In any case it is probably a good
idea to set up a swap partition, too.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo ln -sf /usr/bin/ld /usr/bin/ld.gold
</pre></div>
</div>
</li>
<li><p>ARM development boards can be unstable and you may experience that cores
are disappearing, caches being flushed on every big.LITTLE switch, and
other similar issues. To help ease the effect of this, set the Linux
scheduler to “performance” on <strong>all</strong> cores using this little script:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># The code below requires the package 'cpufrequtils' to be installed.</span>
<span class="k">for</span> <span class="o">((</span><span class="nv">cpu</span><span class="o">=</span><span class="m">0</span><span class="p">;</span> cpu<<span class="sb">`</span>grep -c proc /proc/cpuinfo<span class="sb">`</span><span class="p">;</span> cpu++<span class="o">))</span><span class="p">;</span> <span class="k">do</span>
sudo cpufreq-set -c <span class="nv">$cpu</span> -g performance
<span class="k">done</span>
</pre></div>
</div>
<p>Remember to turn that off after the build, or you may risk burning your
CPU. Most modern kernels don’t need that, so only use it if you have
problems.</p>
</li>
<li><p>Running the build on SD cards is ok, but they are more prone to failures
than good quality USB sticks, and those are more prone to failures than
external hard-drives (those are also a lot faster). So, at least, you
should consider to buy a fast USB stick. On systems with a fast eMMC,
that’s a good option too.</p></li>
<li><p>Make sure you have a decent power supply (dozens of dollars worth) that can
provide <em>at least</em> 4 amperes, this is especially important if you use USB
devices with your board. Externally powered USB/SATA harddrives are even
better than having a good power supply.</p></li>
</ol>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="HowToBuildWithPGO.html" title="How To Build Clang and LLVM with Profile-Guided Optimizations"
>next</a> |</li>
<li class="right" >
<a href="GoldPlugin.html" title="The LLVM gold plugin"
>previous</a> |</li>
<li><a href="https://llvm.org/">LLVM Home</a> | </li>
<li><a href="index.html">Documentation</a>»</li>
<li class="nav-item nav-item-1"><a href="UserGuides.html" >User Guides</a> »</li>
<li class="nav-item nav-item-this"><a href="">How To Build On ARM</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2003-2021, LLVM Project.
Last updated on 2021-09-18.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.4.
</div>
</body>
</html>
|