kumquat-buildroot/package/llvm/Config.in

61 lines
1.7 KiB
Plaintext
Raw Normal View History

package/llvm: new package 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>
2018-04-04 18:31:18 +02:00
config BR2_PACKAGE_LLVM_ARCH_SUPPORTS
bool
default y if BR2_i386
default y if BR2_x86_64
default y if BR2_aarch64
default y if BR2_arm || BR2_armeb
config BR2_PACKAGE_LLVM_TARGET_ARCH
string
default "AArch64" if BR2_aarch64
default "ARM" if BR2_arm || BR2_armeb
default "X86" if BR2_i386 || BR2_x86_64
config BR2_PACKAGE_LLVM
bool "llvm"
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_INSTALL_LIBSTDCPP
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
depends on !BR2_STATIC_LIBS
depends on BR2_USE_WCHAR # std::wstring
package/llvm: new package 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>
2018-04-04 18:31:18 +02:00
help
The LLVM Project is a collection of modular and reusable
compiler and toolchain technologies.
http://llvm.org
if BR2_PACKAGE_LLVM
config BR2_PACKAGE_LLVM_AMDGPU
bool "AMDGPU backend"
help
Build AMDGPU target. Select this option if you are going
to install mesa3d with llvm and use Gallium Radeon driver.
config BR2_PACKAGE_LLVM_RTTI
bool "enable rtti"
help
Build LLVM with run-time type information. LLVM can be built
without rtti, but turning it off changes the ABI of C++
programs.
This features is needed to build the Gallium Nouveau driver
or the Clover OpenCL state tracker when llvm support is
enabled.
https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html
endif
comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
package/llvm: new package 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>
2018-04-04 18:31:18 +02:00
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
|| BR2_STATIC_LIBS || !BR2_USE_WCHAR
comment "llvm needs a toolchain not affected by GCC bug 64735"
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735