0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 ===================================================================
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 How To Build On ARM
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 ===================================================================
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 Introduction
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 ============
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 This document contains information about building/testing LLVM and
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 Clang on an ARM machine.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 This document is *NOT* tailored to help you cross-compile LLVM/Clang
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 to ARM on another architecture, for example an x86_64 machine. To find
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 out more about cross-compiling, please check :doc:`HowToCrossCompileLLVM`.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 Notes On Building LLVM/Clang on ARM
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 =====================================
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 Here are some notes on building/testing LLVM/Clang on ARM. Note that
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 ARM encompasses a wide variety of CPUs; this advice is primarily based
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 on the ARMv6 and ARMv7 architectures and may be inapplicable to older chips.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20
|
100
|
21 #. The most popular Linaro/Ubuntu OS's for ARM boards, e.g., the
|
|
22 Pandaboard, have become hard-float platforms. There are a number of
|
|
23 choices when using CMake. Autoconf usage is deprecated as of 3.8.
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24
|
100
|
25 Building LLVM/Clang in ``Relese`` mode is preferred since it consumes
|
|
26 a lot less memory. Otherwise, the building process will very likely
|
|
27 fail due to insufficient memory. It's also a lot quicker to only build
|
|
28 the relevant back-ends (ARM and AArch64), since it's very unlikely that
|
|
29 you'll use an ARM board to cross-compile to other arches. If you're
|
|
30 running Compiler-RT tests, also include the x86 back-end, or some tests
|
|
31 will fail.
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 .. code-block:: bash
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34
|
100
|
35 cmake $LLVM_SRC_DIR -DCMAKE_BUILD_TYPE=Release \
|
|
36 -DLLVM_TARGETS_TO_BUILD="ARM;X86;AArch64"
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37
|
100
|
38 Other options you can use are:
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 .. code-block:: bash
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41
|
100
|
42 Use Ninja instead of Make: "-G Ninja"
|
|
43 Build with assertions on: "-DLLVM_ENABLE_ASSERTIONS=True"
|
|
44 Force Python2: "-DPYTHON_EXECUTABLE=/usr/bin/python2"
|
|
45 Local (non-sudo) install path: "-DCMAKE_INSTALL_PREFIX=$HOME/llvm/instal"
|
|
46 CPU flags: "DCMAKE_C_FLAGS=-mcpu=cortex-a15" (same for CXX_FLAGS)
|
|
47
|
|
48 After that, just typing ``make -jN`` or ``ninja`` will build everything.
|
|
49 ``make -jN check-all`` or ``ninja check-all`` will run all compiler tests. For
|
|
50 running the test suite, please refer to :doc:`TestingGuide`.
|
|
51
|
|
52 #. If you are building LLVM/Clang on an ARM board with 1G of memory or less,
|
|
53 please use ``gold`` rather then GNU ``ld``. In any case it is probably a good
|
|
54 idea to set up a swap partition, too.
|
|
55
|
|
56 .. code-block:: bash
|
|
57
|
|
58 $ sudo ln -sf /usr/bin/ld /usr/bin/ld.gold
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 #. ARM development boards can be unstable and you may experience that cores
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 are disappearing, caches being flushed on every big.LITTLE switch, and
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 other similar issues. To help ease the effect of this, set the Linux
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 scheduler to "performance" on **all** cores using this little script:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 .. code-block:: bash
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 # The code below requires the package 'cpufrequtils' to be installed.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 for ((cpu=0; cpu<`grep -c proc /proc/cpuinfo`; cpu++)); do
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 sudo cpufreq-set -c $cpu -g performance
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 done
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71
|
100
|
72 Remember to turn that off after the build, or you may risk burning your
|
|
73 CPU. Most modern kernels don't need that, so only use it if you have
|
|
74 problems.
|
|
75
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 #. Running the build on SD cards is ok, but they are more prone to failures
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 than good quality USB sticks, and those are more prone to failures than
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78 external hard-drives (those are also a lot faster). So, at least, you
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 should consider to buy a fast USB stick. On systems with a fast eMMC,
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80 that's a good option too.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 #. Make sure you have a decent power supply (dozens of dollars worth) that can
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 provide *at least* 4 amperes, this is especially important if you use USB
|
100
|
84 devices with your board. Externally powered USB/SATA harddrives are even
|
|
85 better than having a good power supply.
|