kumquat-buildroot/package/rustc/Config.in.host
Romain Naour 8520058ac0 package/rustc: needs C++ compiler with musl based toolchain
While building host-rust with a musl based toolchain without C++ compiler,
the build fail since libunwind bundled in rust sources needs a C++ compiler.

cargo:warning=i686-buildroot-linux-musl-gcc.br_real: error: [...]/host-rust-1.62.0/src/llvm-project/libunwind/src/Unwind-EHABI.cpp: C++ compiler not installed on this system

Note: the issues can't be reproduced with a glibc based toolchain
without C++ probaly due to extra steps required to support musl libc.

We could add the C++ dependency direclty to host-rustc but it would
requires adding the C++ reverse dependencies to all rust packages.

Instread, we add the C++ dependency to BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
only when a musl toolchain is used. So we can still install a prebuilt
rust compiler but without the rust standard library (rust-std).

Usually we should not add toolchain dependencies in a _ARCH_SUPPORTS option but
BR2_PACKAGE_HOST_RUSTC_TARGET_TIER... options contains already some
BR2_TOOLCHAIN_USES_GLIBC or BR2_TOOLCHAIN_USES_MUSL.

Fixes:
http://autobuild.buildroot.org/results/636/636fb39c8f1b8c05e4ca451ac506cd63c7166d82

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Reviewed-by: Nicolas Tran <nicolas.tran@smile.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-08-30 21:12:34 +02:00

187 lines
7.5 KiB
Plaintext

# All host rust packages should depend on this option
config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
bool
default y if BR2_HOSTARCH = "aarch64"
default y if BR2_HOSTARCH = "mips"
default y if BR2_HOSTARCH = "mipsel"
default y if BR2_HOSTARCH = "powerpc"
default y if BR2_HOSTARCH = "powerpc64"
default y if BR2_HOSTARCH = "powerpc64le"
default y if BR2_HOSTARCH = "riscv64"
default y if BR2_HOSTARCH = "s390x"
default y if BR2_HOSTARCH = "x86"
default y if BR2_HOSTARCH = "x86_64"
# The pre-built Rust standard library is only available for a number
# of architectures/C libraries combinations, with different levels of
# support: Tier 1 platforms, Tier 2 platforms with host tools, Tier 2
# platforms, Tier 3 platforms. Below, we support Tier 1, Tier 2 with
# host tools and Tier 2 platforms.
# The below entries match Tier 1 platforms as described at
# https://doc.rust-lang.org/nightly/rustc/platform-support.html.
config BR2_PACKAGE_HOST_RUSTC_TARGET_TIER1_PLATFORMS
bool
# aarch64-unknown-linux-gnu
default y if BR2_aarch64 && BR2_TOOLCHAIN_USES_GLIBC
# i686-unknown-linux-gnu
default y if (BR2_x86_i686 || BR2_x86_pentiumpro || BR2_X86_CPU_HAS_MMX) && BR2_TOOLCHAIN_USES_GLIBC
# x86_64-unknown-linux-gnu
default y if BR2_x86_64 && BR2_TOOLCHAIN_USES_GLIBC
# The below entries match Tier 2 platforms with host tools as
# described at
# https://doc.rust-lang.org/nightly/rustc/platform-support.html.
config BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_HOST_TOOLS_PLATFORMS
bool
# aarch64-unknown-linux-musl
default y if BR2_aarch64 && BR2_TOOLCHAIN_USES_MUSL
# arm-unknown-linux-gnueabi
default y if BR2_ARM_CPU_ARMV6 && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_GLIBC
# arm-unknown-linux-gnueabihf
default y if BR2_ARM_CPU_ARMV6 && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_GLIBC
# armv7-unknown-linux-gnueabihf
default y if BR2_ARM_CPU_ARMV7A && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_GLIBC
# armv7-unknown-linux-gnueabihf for armv8 hardware with 32-bit
# userspace
default y if BR2_arm && BR2_ARM_CPU_ARMV8A && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_GLIBC
# mips-unknown-linux-gnu
default y if BR2_mips && BR2_TOOLCHAIN_USES_GLIBC && !BR2_MIPS_CPU_MIPS32R6
# mips64-unknown-linux-gnuabi64
default y if BR2_mips64 && BR2_TOOLCHAIN_USES_GLIBC && BR2_MIPS_NABI64 && !BR2_MIPS_CPU_MIPS64R6
# mipsel-unknown-linux-gnu
default y if BR2_mipsel && BR2_TOOLCHAIN_USES_GLIBC && !BR2_MIPS_CPU_MIPS32R6
# mips64el-unknown-linux-gnuabi64
default y if BR2_mips64el && BR2_TOOLCHAIN_USES_GLIBC && BR2_MIPS_NABI64 && !BR2_MIPS_CPU_MIPS64R6
# powerpc-unknown-linux-gnu
default y if BR2_powerpc && BR2_TOOLCHAIN_USES_GLIBC
# powerpc64-unknown-linux-gnu
default y if BR2_powerpc64 && BR2_TOOLCHAIN_USES_GLIBC
# powerpc64le-unknown-linux-gnu
default y if BR2_powerpc64le && BR2_TOOLCHAIN_USES_GLIBC
# riscv64gc-unknown-linux-gnu
# "g" stands for imafd, and we also need "c".
default y if BR2_RISCV_64 && BR2_RISCV_ISA_RVI && BR2_RISCV_ISA_RVM && \
BR2_RISCV_ISA_RVA && BR2_RISCV_ISA_RVF && \
BR2_RISCV_ISA_RVD && BR2_RISCV_ISA_RVC && \
BR2_TOOLCHAIN_USES_GLIBC
# s390x-unknown-linux-gnu
default y if BR2_s390x && BR2_TOOLCHAIN_USES_GLIBC
# x86_64-unknown-linux-musl
default y if BR2_x86_64 && BR2_TOOLCHAIN_USES_MUSL
# The below entries match Tier 2 platforms without host tools as
# described at
# https://doc.rust-lang.org/nightly/rustc/platform-support.html.
config BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_PLATFORMS
bool
# arm-unknown-linux-musleabi
default y if BR2_ARM_CPU_ARMV6 && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_MUSL
# arm-unknown-linux-musleabihf
default y if BR2_ARM_CPU_ARMV6 && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_MUSL
# armv5te-unknown-linux-gnueabi
default y if BR2_ARM_CPU_ARMV5 && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_GLIBC
# armv5te-unknown-linux-musleabi
default y if BR2_ARM_CPU_ARMV5 && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_MUSL
# armv7-unknown-linux-gnueabi
default y if BR2_ARM_CPU_ARMV7A && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_GLIBC
# armv7-unknown-linux-musleabi
default y if BR2_ARM_CPU_ARMV7A && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_MUSL
# armv7-unknown-linux-musleabihf
default y if BR2_ARM_CPU_ARMV7A && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_MUSL
# armv7-unknown-linux-musleabihf for armv8 hardware with 32-bit
# userspace
default y if BR2_arm && BR2_ARM_CPU_ARMV8A && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_MUSL
# i586-unknown-linux-gnu
default y if BR2_x86_i586 && BR2_TOOLCHAIN_USES_GLIBC
# i586-unknown-linux-musl
default y if BR2_x86_i586 && BR2_TOOLCHAIN_USES_MUSL
# i686-unknown-linux-musl
default y if (BR2_x86_i686 || BR2_x86_pentiumpro || BR2_X86_CPU_HAS_MMX) && BR2_TOOLCHAIN_USES_MUSL
# mips-unknown-linux-musl
default y if BR2_mips && BR2_TOOLCHAIN_USES_MUSL && !BR2_MIPS_CPU_MIPS32R6
# mips64-unknown-linux-muslabi64
default y if BR2_mips64 && BR2_TOOLCHAIN_USES_MUSL && BR2_MIPS_NABI64 && !BR2_MIPS_CPU_MIPS64R6
# mips64el-unknown-linux-muslabi64
default y if BR2_mips64el && BR2_TOOLCHAIN_USES_MUSL && BR2_MIPS_NABI64 && !BR2_MIPS_CPU_MIPS64R6
# mipsel-unknown-linux-musl
default y if BR2_mipsel && BR2_TOOLCHAIN_USES_MUSL && !BR2_MIPS_CPU_MIPS32R6
# sparc64-unknown-linux-gnu
default y if BR2_sparc64 && BR2_TOOLCHAIN_USES_GLIBC
# All target rust packages should depend on this option
# Note: With musl based toolchain, we need a C++ cross compiler to
# build host-rust some target libraries (libunwind) from llvm source
# code bundled in rust sources.
config BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
bool
default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER1_PLATFORMS
default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_HOST_TOOLS_PLATFORMS
default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_PLATFORMS
depends on BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
config BR2_PACKAGE_HOST_RUSTC_ARCH
string
default "armv5te" if BR2_ARM_CPU_ARMV5
default "arm" if BR2_ARM_CPU_ARMV6
default "armv7" if BR2_ARM_CPU_ARMV7A
default "armv7" if BR2_ARM_CPU_ARMV7A || (BR2_arm && BR2_ARM_CPU_ARMV8A)
default "riscv64gc" if BR2_RISCV_64
default BR2_ARCH
config BR2_PACKAGE_HOST_RUSTC_ABI
string
default "eabi" if BR2_ARM_EABI
default "eabihf" if BR2_ARM_EABIHF
default "abi64" if BR2_MIPS_NABI64
config BR2_PACKAGE_HOST_RUSTC
bool "host rustc"
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
help
Compiler for the Rust language
http://www.rust-lang.org
if BR2_PACKAGE_HOST_RUSTC
choice
prompt "Rust compiler variant"
default BR2_PACKAGE_HOST_RUST_BIN
help
Select a Rust compiler
config BR2_PACKAGE_HOST_RUST
bool "host rust"
# RUSTC_TARGET_NAME must be set for building host-rust
# otherwise config.toml is broken.
depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
# triggers ICE on trunc_int_for_mode, at explow.c:56
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 || !BR2_aarch64
help
This package will build the compiler for the host as well as
two flavors of the standard library: one for the host, another
for the target. Both are installed in the host directory.
comment "host-rust needs a toolchain w/ gcc >= 5"
depends on BR2_aarch64
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5
config BR2_PACKAGE_HOST_RUST_BIN
bool "host rust (pre-built)"
help
This package will install pre-built versions of the compiler
for the host and the Rust standard library for the target.
endchoice
endif
config BR2_PACKAGE_PROVIDES_HOST_RUSTC
string
default "host-rust" if BR2_PACKAGE_HOST_RUST
# Default to host-rust-bin as long as host arch supports it
default "host-rust-bin" if !BR2_PACKAGE_HOST_RUST
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS