Lines Matching +full:ninja +full:- +full:linux

2 How To Cross-Compile Clang/LLVM using Clang/LLVM
11 For more information on how to use Clang as a cross-compiler,
16 Cross-Compiling from x86_64 to ARM
19 In this use case, we'll be using CMake and Ninja, on a Debian-based Linux
20 system, cross-compiling from an x86_64 host (most Intel and AMD chips
21 nowadays) to a hard-float ARM target (most ARM targets nowadays).
26 * ``ninja-build`` (from backports in Ubuntu)
27 * ``gcc-4.7-arm-linux-gnueabihf``
28 * ``gcc-4.7-multilib-arm-linux-gnueabihf``
29 * ``binutils-arm-linux-gnueabihf``
30 * ``libgcc1-armhf-cross``
31 * ``libsfgcc1-armhf-cross``
32 * ``libstdc++6-armhf-cross``
33 * ``libstdc++6-4.7-dev-armhf-cross``
36 -----------------
43 * ``-DCMAKE_CROSSCOMPILING=True``
44 * ``-DCMAKE_INSTALL_PREFIX=<install-dir>``
45 * ``-DLLVM_TABLEGEN=<path-to-host-bin>/llvm-tblgen``
46 * ``-DCLANG_TABLEGEN=<path-to-host-bin>/clang-tblgen``
47 * ``-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf``
48 * ``-DLLVM_TARGET_ARCH=ARM``
49 * ``-DLLVM_TARGETS_TO_BUILD=ARM``
54 * ``-DCMAKE_CXX_FLAGS='-march=armv7-a -mcpu=cortex-a9 -mfloat-abi=hard'``
56 However, if you're using Clang, the driver might not be up-to-date with your
57 specific Linux distribution, version or GCC layout, so you'll need to fudge.
61 * ``'-target arm-linux-gnueabihf'`` or whatever is the triple of your cross GCC.
62 * ``'--sysroot=/usr/arm-linux-gnueabihf'``, ``'--sysroot=/opt/gcc/arm-linux-gnueabihf'``
64 * Appropriate use of ``-I`` and ``-L``, depending on how the cross GCC is installed,
68 so you'll need to compile LLVM (or at least ``llvm-tblgen``) to your host
70 defaults to ``fpu=VFP3`` with NEON), and forcing the hard-float ABI. If you're
71 using Clang as a cross-compiler, you will *also* have to set ``--sysroot``
77 libraries will be found. You'll still need to use ``-I`` and ``-L`` to locate
82 all back-ends. For that reason, you should also set the
83 ``TARGETS_TO_BUILD`` to only build the back-end you're targeting to.
85 You must set the ``CMAKE_INSTALL_PREFIX``, otherwise a ``ninja install``
90 -----
95 #. If you're using Clang as the cross-compiler, there is a problem in
96 the LLVM ARM back-end that is producing absolute relocations on
97 position-independent code (``R_ARM_THM_MOVW_ABS_NC``), so for now, you
100 .. code-block:: bash
102 -DLLVM_ENABLE_PIC=False
125 will have the shared objects (``.so``) and the ``libXXX-dev`` will
135 symbolic links (if necessary), and add the relevant ``-L``
136 and ``-I`` paths to ``-DCMAKE_CXX_FLAGS`` above.
140 --------------------------
144 .. code-block:: bash
146 $ cmake -G Ninja <source-dir> <options above>
148 If you're using Clang as the cross-compiler, run:
150 .. code-block:: bash
152 $ CC='clang' CXX='clang++' cmake -G Ninja <source-dir> <options above>
155 Ninja files will be created in the build directory. I strongly suggest
161 .. code-block:: bash
163 $ ninja
168 You can't run ``ninja check-all`` on this tree because the created
172 --------------------
177 .. code-block:: bash
179 $ ninja install
181 which will create a sysroot on the install-dir. You can then tar
185 .. code-block:: bash
187 $ ln -sf <install-dir> arm-linux-gnueabihf-clang
188 $ tar zchf arm-linux-gnueabihf-clang.tar.gz arm-linux-gnueabihf-clang
191 it for running the test-suite, for example. Follow the guidelines at
195 .. code-block:: bash
198 --sandbox sandbox \
199 --test-suite `pwd`/test-suite \
200 --cc `pwd`/arm-linux-gnueabihf-clang/bin/clang \
201 --cxx `pwd`/arm-linux-gnueabihf-clang/bin/clang++
203 Remember to add the ``-jN`` options to ``lnt`` to the number of CPUs