85 lines · plain
1===================================================================2How To Build On ARM3===================================================================4 5Introduction6============7 8This document contains information about building/testing LLVM and9Clang on an ARM machine.10 11This document is *NOT* tailored to help you cross-compile LLVM/Clang12to ARM on another architecture, for example an x86_64 machine. To find13out more about cross-compiling, please check :doc:`HowToCrossCompileLLVM`.14 15Notes On Building LLVM/Clang on ARM16=====================================17Here are some notes on building/testing LLVM/Clang on ARM. Note that18ARM encompasses a wide variety of CPUs; this advice is primarily based19on the ARMv6 and ARMv7 architectures and may be inapplicable to older chips.20 21#. The most popular Linaro/Ubuntu OS's for ARM boards, e.g., the22 Pandaboard, have become hard-float platforms. There are a number of23 choices when using CMake. Autoconf usage is deprecated as of 3.8.24 25 Building LLVM/Clang in ``Release`` mode is preferred since it consumes26 a lot less memory. Otherwise, the build process will very likely27 fail due to insufficient memory. It's also a lot quicker to only build28 the relevant back-ends (ARM and AArch64), since it's very unlikely that29 you'll use an ARM board to cross-compile to other architectures. If you're30 running Compiler-RT tests, also include the x86 back-end, or some tests31 will fail.32 33 .. code-block:: bash34 35 cmake $LLVM_SRC_DIR -DCMAKE_BUILD_TYPE=Release \36 -DLLVM_TARGETS_TO_BUILD="ARM;X86;AArch64"37 38 Other options you can use are:39 40 .. code-block:: bash41 42 Use Ninja instead of Make: "-G Ninja"43 Build with assertions on: "-DLLVM_ENABLE_ASSERTIONS=True"44 Local (non-sudo) install path: "-DCMAKE_INSTALL_PREFIX=$HOME/llvm/install"45 CPU flags: "DCMAKE_C_FLAGS=-mcpu=cortex-a15" (same for CXX_FLAGS)46 47 After that, just typing ``make -jN`` or ``ninja`` will build everything.48 ``make -jN check-all`` or ``ninja check-all`` will run all compiler tests. For49 running the test suite, please refer to :doc:`TestingGuide`.50 51#. If you are building LLVM/Clang on an ARM board with 1 GB of memory or less,52 please use ``gold`` rather than GNU ``ld``. In any case, it is probably a good53 idea to set up a swap partition, too.54 55 .. code-block:: bash56 57 $ sudo ln -sf /usr/bin/ld /usr/bin/ld.gold58 59#. ARM development boards can be unstable, and you may experience that cores60 are disappearing, caches being flushed on every big.LITTLE switch, and61 other similar issues. To help ease the effect of this, set the Linux62 scheduler to "performance" on **all** cores using this little script:63 64 .. code-block:: bash65 66 # The code below requires the package 'cpufrequtils' to be installed.67 for ((cpu=0; cpu<`grep -c proc /proc/cpuinfo`; cpu++)); do68 sudo cpufreq-set -c $cpu -g performance69 done70 71 Remember to turn that off after the build, or you may risk burning your72 CPU. Most modern kernels don't need that, so only use it if you have73 problems.74 75#. Running the build on SD cards is ok, but they are more prone to failures76 than good-quality USB sticks, and those are more prone to failures than77 external hard drives (those are also a lot faster). So, at least, you78 should consider to buy a fast USB stick. On systems with a fast eMMC,79 that's a good option too.80 81#. Make sure you have a decent power supply (dozens of dollars worth) that can82 provide *at least* 4 amperes. This is especially important if you use USB83 devices with your board. Externally powered USB/SATA hard drives are even84 better than having a good power supply.85