Skip to content

Building with lld and download-ci-llvm #98340

Closed
@SimonSapin

Description

@SimonSapin

I order to try local patches on a cross-compiled project, I built with ./x.py build --target x86_64-unknown-linux-gnu,riscv32i-unknown-none-elf then, in my project set rust-toolchain.toml to path = "/home/simon/projects/rust/build/x86_64-unknown-linux-gnu/stage1/". The first error message was:

  = note: Could not find tool: lld
          at: /home/simon/projects/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin/rust-lld
          Consider `rustup component add llvm-tools-preview`

It was not obvious in ./x.py build --help or config.toml.example how to build llvm-tools-preview for a local toolchain, but folks on Zulip pointed me to adding [rust] lld = true to config.toml.

Rebuilding the toolchain failed with:

Writer.cpp:(.text._ZN3lld4wasm12_GLOBAL__N_16Writer3runEv+0x23f8): undefined reference to `llvm::parallelForEachN(unsigned long, unsigned long, llvm::function_ref<void (unsigned long)>)'

My config.toml also had profile = "compiler" which enables download-ci-llvm = "if-available". It looks like building LLD from source doesn’t work when LLVM artifacts are downloaded from CI.

This configuration should either download LLD from CI too, or print a better error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions