Skip to content

Building an out-of-tree rustc driver against a locally built toolchain no longer works #154262

@RalfJung

Description

@RalfJung

Sometimes (rarely, but sometimes) I have to build out-of-tree Miri against a patched version of rustc. This used to work as follows:

# in the rustc folder
./x build --stage 2 library
# in the miri folder
cargo overwrite set src-rustc-stage2 # a toolchain that points to `build/host/stage2`
./miri build

However, this no longer works. I now get a bunch of errors like this

error[E0463]: can't find crate for `rustc_abi`
  --> src/lib.rs:63:1
   |
63 | extern crate rustc_abi;
   | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
   |

As a work-around, what I currently do is I make a rustc PR and trigger a try build to get a prebuilt toolchain that I can then build Miri against. Needless to say that makes the edit-compile-test cycle pretty painful.^^

I am not entirely sure what happens, but I seem to recall some discussion of not copying the rustc_* crates into the sysroot any more as that copy step was causing trouble, and instead making them available via some other means (#144252). That would likely explain the problem -- the crates aren't in the sysroot so when I build Miri out-of-tree they can't be used. Is there some way to make such out-of-tree builds possible again without re-introducing whatever problems were solved when bootstrap changed how the rustc crates are handled?

Cc @Kobzol @jieyouxu

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions