Skip to content

rules_foreign_cc: provide prebuilt cmake 3.31.8 for riscv64#2377

Open
monkey-jsun wants to merge 5 commits intogoogle:mainfrom
monkey-jsun:pr/cmake-riscv64
Open

rules_foreign_cc: provide prebuilt cmake 3.31.8 for riscv64#2377
monkey-jsun wants to merge 5 commits intogoogle:mainfrom
monkey-jsun:pr/cmake-riscv64

Conversation

@monkey-jsun
Copy link
Copy Markdown

Add riscv64 entry to prebuilt_toolchains.bzl pointing to cmake 3.31.8
built from source and hosted on GitHub releases. Avoids 3+ hour
bootstrap from source on riscv64 hardware.

Note this PR depends on #2376

Patch rules_rust 0.68.1 to support riscv64 as a host architecture:
- Add riscv64gc to supported linux architectures in triple.bzl
- Add riscv64gc-unknown-linux-gnu to SUPPORTED_PLATFORM_TRIPLES
  in crate_universe for generated BUILD files
- Register riscv64gc Rust toolchain with Rust 1.86.0
toolchains_llvm 1.6.0 does not support riscv64 as a host architecture.
Patch three files to add linux-riscv64:
- toolchain/internal/common.bzl: add (linux, riscv64) to SUPPORTED_TARGETS
- toolchain/internal/configure.bzl: add riscv64-unknown-linux-gnu target
  system name mapping
- toolchain/cc_toolchain_config.bzl: add linux-riscv64 toolchain config
  entry mirroring linux-aarch64

Also configure llvm.MODULE.bazel to use the system-installed clang-19
at /usr/lib/llvm-19 as the toolchain root for riscv64, since no
prebuilt LLVM distribution exists for riscv64 Linux host.
  _is_hermetic_or_exists needs to strip the %workspace% prefix before
checking path existence, so include dirs like lib64/ or arch-specific
c++/v1 are filtered out when they don't exist on the host. This
is a generic bug affecting any toolchain_root usage with absolute paths.
…fig.guess

Add riscv64 to SUPPORTED_CPU and triplet_name in platform.bzl.
Pass --build explicitly to pkg-config configure when not cross-
compiling, so outdated config.guess (2015 vintage, bundled in
pkg-config 0.29.2) does not need to detect the host architecture.
Add riscv64 entry to prebuilt_toolchains.bzl pointing to cmake 3.31.8
built from source and hosted on GitHub releases.  Avoids 3+ hour
bootstrap from source on riscv64 hardware.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant