Lines Matching +full:bare +full:- +full:cross +full:- +full:build
2 Cross-compilation using Clang
9 for cross-compiling your code to a different architecture. It assumes you
14 build system or Makefiles, nor choosing the right CMake options, etc.
17 `instructions for cross-compiling LLVM itself
21 related to cross-compilation, and what main compiler options Clang provides
22 for performing cross-compilation.
24 Cross compilation issues
29 with all files in, unzip to a directory and point the build system to
33 On the other hand, Clang/LLVM is natively a cross-compiler, meaning that
34 one set of programs can compile to all targets by setting the ``-target``
37 only have to maintain one build system, and for OS distributions, that
40 But, as is true to any cross-compiler, and given the complexity of
47 ``compiler-rt``, ``libcxx``, ``libgcc``, ``libm``, etc), so you'll have to
48 find and make available to the build system, every other library required
49 to build your software, that is specific to your target. It's not enough to
53 option will work magically. Some options, like ``--sysroot`` (which
56 true when your cross-compiler was installed by the distribution's package
58 option, and in most cases, you'll end up setting include paths (``-I``) and
59 library paths (``-L``) manually.
65 * need special options, which your build system won't be able to figure
68 General Cross-Compilation Options in Clang
72 -------------
75 ``-target <triple>``. If you don't specify the target, CPU names won't
80 The triple has the general format ``<arch><sub>-<vendor>-<sys>-<abi>``, where:
87 The sub-architecture options are available for their own architectures,
93 like the bare-metal "none".
105 -------------
112 * ``-mcpu=<cpu-name>``, like x86-64, swift, cortex-a15
113 * ``-mfpu=<fpu-name>``, like SSE3, NEON, controlling the FP unit available
114 * ``-mfloat-abi=<fabi>``, like soft, hard, controlling which registers
115 to use for floating-point
122 For example, if your target is ``arm-none-eabi``, the default CPU will
124 whereas if your triple is ``armv7a-none-eabi``, it'll be Cortex-A8 with
125 NEON, but still using soft-float, which is much better, but still not
129 -----------------
131 There are three main options to control access to your cross-compiler:
132 ``--sysroot``, ``-I``, and ``-L``. The two last ones are well known,
136 There are two main ways to have a cross-compiler:
138 #. When you have extracted your cross-compiler from a zip file into
139 a directory, you have to use ``--sysroot=<path>``. The path is the
148 distributions have cross-compiler packages available), make
150 cross-compiler toolchain.
154 are. People add system-specific clues to Clang often, but as
159 directories manually (via ``-I`` and ``-L``).
161 Target-Specific Libraries
164 All libraries that you compile as part of your build will be
165 cross-compiled to your target, and your build system will probably
170 So, if the build system is not aware that you want to cross-compile
172 will fail during build time, not configure time.
175 as for your host machine. There aren't many cross-libraries available
176 as packages to most OS's, so you'll have to either cross-compile them
179 and add ``-I`` and ``-L`` pointing to them.
184 of your build can get things wrong when setting their own library
189 ---------
191 When you want to cross-compile to more than one configuration, for
192 example hard-float-ARM and soft-float-ARM, you'll have to have multiple
197 forget to specify ``-ccc-gcc-name armv7l-linux-gnueabihf-gcc`` (which
198 uses hard-float), Clang will pick the ``armv7l-linux-gnueabi-ld``
199 (which uses soft-float) and linker errors will happen.
202 and ``androideabi``, and might even link and run, but produce run-time