[PATCH] D38264: [docs] Fix cross-compile instructions
Keno Fischer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 15:22:03 PDT 2017
loladiro created this revision.
Setting the CMAKE_CROSSCOMPILING variable directly does not appear to work.
Instead, CMake is setting this variable based on the presence
or absence of the CMAKE_SYSTEM_NAME variable (in fact, if that variable is
not present, CMAKE_CROSSCOMPILING gets reset to false [1]). Lastly,
building an external tablegen is not necessary. LLVM is capable of
building a native tablegen as needed.
[1] https://github.com/Kitware/CMake/blob/eae3765b67b653d3f00afa44a60719a387262af8/Modules/CMakeDetermineSystem.cmake#L126
https://reviews.llvm.org/D38264
Files:
docs/HowToCrossCompileLLVM.rst
Index: docs/HowToCrossCompileLLVM.rst
===================================================================
--- docs/HowToCrossCompileLLVM.rst
+++ docs/HowToCrossCompileLLVM.rst
@@ -40,13 +40,14 @@
The CMake options you need to add are:
- * ``-DCMAKE_CROSSCOMPILING=True``
+ * ``-DCMAKE_SYSTEM_NAME=Linux`` (this is needed even if the build system is already Linux -
+ the presence of this flag causes CMake to enter cross-compilation mode)
* ``-DCMAKE_INSTALL_PREFIX=<install-dir>``
- * ``-DLLVM_TABLEGEN=<path-to-host-bin>/llvm-tblgen``
- * ``-DCLANG_TABLEGEN=<path-to-host-bin>/clang-tblgen``
* ``-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf``
* ``-DLLVM_TARGET_ARCH=ARM``
* ``-DLLVM_TARGETS_TO_BUILD=ARM``
+ * ``-DCMAKE_C_COMPILER`` and ``-DCMAKE_CXX_COMPILER`` if your cross capable compiler is not
+ the same as your default compiler.
If you're compiling with GCC, you can use architecture options for your target,
and the compiler driver will detect everything that it needs:
@@ -64,9 +65,7 @@
* Appropriate use of ``-I`` and ``-L``, depending on how the cross GCC is installed,
and where are the libraries and headers.
-The TableGen options are required to compile it with the host compiler,
-so you'll need to compile LLVM (or at least ``llvm-tblgen``) to your host
-platform before you start. The CXX flags define the target, cpu (which in this case
+The CXX flags define the target, cpu (which in this case
defaults to ``fpu=VFP3`` with NEON), and forcing the hard-float ABI. If you're
using Clang as a cross-compiler, you will *also* have to set ``--sysroot``
to make sure it picks the correct linker.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38264.116625.patch
Type: text/x-patch
Size: 1648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170925/491f46b3/attachment.bin>
More information about the llvm-commits
mailing list