• Home
  • Raw
  • Download

Lines Matching +full:linux +full:- +full:headers

2 Cross-compilation using Clang
9 for cross-compiling your code to a different architecture. It assumes you
17 `instructions for cross-compiling LLVM itself
21 related to cross-compilation, and what main compiler options Clang provides
22 for performing cross-compilation.
28 headers, libraries, etc. So, it's usually simple to download a package
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``
40 But, as is true to any cross-compiler, and given the complexity of
42 the headers, libraries or binutils to generate target specific code.
47 ``compiler-rt``, ``libcxx``, ``libgcc``, ``libm``, etc), so you'll have to
53 option will work magically. Some options, like ``--sysroot`` (which
54 effectively changes the logical root for headers and libraries), assume
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.
64 * have different sets of libraries and headers by default
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:
84 * ``sys`` = ``none``, ``linux``, ``win32``, ``darwin``, ``cuda``, etc.
87 The sub-architecture options are available for their own architectures,
92 The system name is generally the OS (linux, darwin), but could be special
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,
134 and headers that are specific to your target.
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
144 additional headers or libraries are needed), as Clang will find
147 #. When you have installed via a package manager (modern Linux
148 distributions have cross-compiler packages available), make
150 cross-compiler toolchain.
153 linker), but not always where the target headers and libraries
154 are. People add system-specific clues to Clang often, but as
159 directories manually (via ``-I`` and ``-L``).
161 Target-Specific Libraries
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
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
178 extract the libraries and headers, put them in specific directories
179 and add ``-I`` and ``-L`` pointing to them.
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
193 copies of your libraries and (possibly) headers.
195 Some Linux distributions have support for Multilib, which handle that
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