This patch installs LLVM tools and libraries for the host and libLLVM.so for the target. In order to cross-compile LLVM for the target, LLVM must be installed on the host, or at least llvm-tblgen. This is necessary as the path to host's llvm-tblgen must be specified when cross-compiling using the LLVM_TABLEGEN option. Also, a version of llvm-config that can run on the host will be required by packages that link with LLVM libraries, so we need to generate it and install it in STAGING_DIR/usr/bin. It is important to remark why we need llvm-config(host variant) installed in STAGING dir. This tool is necessary to build applications that use LLVM, as it prints the compiler flags, linker flags and object libraries needed to link against LLVM libs. More info: https://bugs.chromium.org/p/chromium/issues/detail?id=219369 The original idea was to compile only llvm-tblgen and llvm-config for the host, as they are the only necessary components. However, llvm-config tool does not work as expected if it is not linked with libLLVM.so, so we must also enable LLVM_LINK_LLVM_DYLIB, what builds LLVM as a single shared library and links LLVM tools with it. More info: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224847 in comment #11. If we don't build full LLVM for the host, it would be necessary to patch configure.ac from mesa3d if we want dynamic linking, because it uses llvm-config (host variant installed in STAGING_DIR) to get the necessary LLVM libraries to link with, which has the following problems: - llvm-config --shared mode outputs static (even if LLVM is built as one shared library) which leads to link issues with libgallium. - llvm-config --libs outputs all LLVM tiny libs: -lLLVMLTO, -lLLVMPasses,etc instead of the single shared library containing all LLVM components (-lLLVM-5.0) Mesa tries to execute: llvm-config --link-shared --libs, but this outputs llvm-config: error: libLLVM-5.0.so is missing. Given that these problems may arise with other packages that use LLVM, it is preferable to do a full build for the host. Also, having a complete installation of LLVM on the host will also facilitate the integration of Clang front-end, which is going to be added in a future patch. As option LLVM_BUILD_LLVM_DYLIB is enabled for the llvm target variant, a single shared library containing all LLVM components is built. This option is not compatible with BUILD_SHARED_LIBS, which generates one .so per library and is only recommended for use by LLVM developers. Tools and utils are not built for the target. The patch aims to provide LLVM support for other packages. The main options needed to cross-compile LLVM are the following ones: LLVM_TABLEGEN CMAKE_CROSSCOMPILING LLVM_DEFAULT_TARGET_TRIPLE LLVM_HOST_TRIPLE LLVM_TARGET_ARCH LLVM_TARGETS_TO_BUILD Signed-off-by: Valentin Korenblit <valentin.korenblit@smile.fr> [Thomas: - add dependency on thread and C++ and update the Config.in comment accordingly. - make the Config.in comment depend on BR2_PACKAGE_LLVM_ARCH_SUPPORTS so that it isn't disabled on architectures where LLVM is anyway not supported.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> |
||
---|---|---|
arch | ||
board | ||
boot | ||
configs | ||
docs | ||
fs | ||
linux | ||
package | ||
support | ||
system | ||
toolchain | ||
utils | ||
.defconfig | ||
.flake8 | ||
.gitignore | ||
.gitlab-ci.yml | ||
.gitlab-ci.yml.in | ||
CHANGES | ||
Config.in | ||
Config.in.legacy | ||
COPYING | ||
DEVELOPERS | ||
Makefile | ||
Makefile.legacy | ||
README |
Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems through cross-compilation. The documentation can be found in docs/manual. You can generate a text document with 'make manual-text' and read output/docs/manual/manual.text. Online documentation can be found at http://buildroot.org/docs.html To build and use the buildroot stuff, do the following: 1) run 'make menuconfig' 2) select the target architecture and the packages you wish to compile 3) run 'make' 4) wait while it compiles 5) find the kernel, bootloader, root filesystem, etc. in output/images You do not need to be root to build or run buildroot. Have fun! Buildroot comes with a basic configuration for a number of boards. Run 'make list-defconfigs' to view the list of provided configurations. Please feed suggestions, bug reports, insults, and bribes back to the buildroot mailing list: buildroot@buildroot.org You can also find us on #buildroot on Freenode IRC. If you would like to contribute patches, please read https://buildroot.org/manual.html#submitting-patches