# build-toolchain **Repository Path**: gysoftv1/build-toolchain ## Basic Information - **Project Name**: build-toolchain - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-01-23 - **Last Updated**: 2025-09-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # English Usage: ./build.sh [--i-believe-sources-are-trustworthy] [bootstrap] [host] [target]... Environment variables: BUILD_DIR build directory INSTALL_PREFIX install directory --i-believe-sources-are-trustworthy Skip re-extracting sources. Must be the first argument. bootstrap Compile the minimal usable Clang toolchain with the system compiler (cc/c++ or environment variables "CC"/"CXX"). Default on if $INSTALL_PREFIX/bin/clang is not detected. host Compile Clang with Clang. Default on if $INSTALL_PREFIX/bin/clang is not detected or its version is lower than $LLVM_VERSION. bootstrap implies host. target Toolchain target triplet, see Note: musl may have some limitations, e.g. arm64 will be recognized as arm instead of aarch64, so it should be aarch64; see Currently Clang toolchain only enables ARM, AArch64, BPF, X86 (including 64-bit) compilation. Modify the LLVM_TARGETS_TO_BUILD variable in build.sh if necessary. # 中文 用法: ./build.sh [--i-believe-sources-are-trustworthy] [bootstrap] [host] [target]... 环境变量: BUILD_DIR 构建目录 INSTALL_PREFIX 安装目录 --i-believe-sources-are-trustworthy 跳过重新解压源代码。必须是第一个参数。 bootstrap 用系统编译器 (cc/c++ 或者环境变量“CC”/“CXX”) 编译最小可用 Clang 工具链。如果检测不到 $INSTALL_PREFIX/bin/clang 则默认运行。 host 用 Clang 编译 Clang。如果检测不到 $INSTALL_PREFIX/bin/clang 或者版本比 $LLVM_VERSION 低,则默认运行。 编译 bootstrap 会自动编译 host。 target 工具链目标,参阅 注意:musl 可能会有些限制,例如 arm64 会被认为是 arm 而不是 aarch64,所以应该用 aarch64;参阅 目前Clang工具链只开启编译 ARM、AArch64、BPF、X86 (含 64 位),必要时修改 build.sh 的 LLVM_TARGETS_TO_BUILD 变量。 # Example To boostrap and build ARMv7 and AArch64 cross-compilation toolchains: ./build.sh bootstrap host armv7-unknown-linux-musleabihf aarch64-unknown-linux-musl To (re)build x86_64 toolchain: ./build.sh x86_64-unknown-linux-musl # Notes 1. Every time LLVM version updated, all toolchains should be rebuilt. 2. Host toolchain builds native binaries (gnueabi?) if --target and --sysroot not specified on compilation. 1. 每次 LLVM 版本更新,所有工具链目标都应该重新构建。 2. 默认编译时如果没有指定 --target 和 --sysroot 则会构建适用本地运行得二进制文件(例如是 GNU ABI 的?)。