Increased build time and dependencies due to rust-lld in bootstrap builds

โš“ Rust    ๐Ÿ“… 2025-07-22    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 3      

surdeus

We observed that recent changes in Rust have enabled and built rust-lld as part of the bootstrap process and has significant improvement in build and linking times.

While integrating Rust into our Yocto-based project, we attempted to support and build rust-lld as part of the Rust build process.
During this effort, we encountered a few issues and would like to confirm whether they are expected or indicative of a regression.

Observations:

  1. Additional Build Dependencies
    Enabling rust-lld introduced new dependencies not previously required for the bootstrap build:
    ninja, openssl, pkg-config, bash (A few of them are mentioned in rust/INSTALL.md at master ยท rust-lang/rust ยท GitHub)

    Following errors were encountered:

1.
   error: failed to run custom build command for `openssl-sys v0.9.106`
   | Could not find openssl via pkg-config:
   |   The pkg-config command could not be found.

   2.
   | Building LLD for x86_64-unknown-linux-gnu
   |
   | Couldn't find required command: ninja (or ninja-build)
   |
   | You should install ninja as described at
   | <https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages>,
   | or set `ninja = false` in the `[llvm]` section of `config.toml`.
   | Alternatively, set `download-ci-llvm = true` in that `[llvm]` section
   | to download LLVM rather than building it.
  1. Increase in Build Time and Filesystem Usage
    We observed significant increases in both build time and disk usage during the bootstrap process:

    Build time increased from ~32 minutes to ~45 minutes (+40%)
    Disk usage increased from ~10 GB to ~13 GB (+30%)

Questions & Concerns:

  • Is there a comprehensive document or reference for rust-lld that outlines its purpose, requirements, and implications for downstream build systems?
  • Are these additional dependencies and the observed increases in build time and space expected as part of rust-lld support, or could this be a regression?
  • Based on our understanding, rust-lld is not yet fully stable and is currently enabled by default only for x86_64-unknown-linux-gnu. We also noticed (this commit, Do not enable LLD by default in the dist profile by Kobzol ยท Pull Request #143255 ยท rust-lang/rust ยท GitHub) disables rust-lld by default in distributed Rust sources.

Given the impact on various downstream distributions and the current stability status of rust-lld, is it recommended to enable and build rust-lld in place of the system/default linker for Rust-based projects?

We would appreciate any clarification or guidance on the intended usage and roadmap for rust-lld, especially for embedded and cross-compilation use cases.
Thanks.

4 posts - 2 participants

Read full topic

๐Ÿท๏ธ rust_feed