Skip to content

Cannot cross-compile with rustc-dev package (or with any pre-built rlib files that depend on proc-macros, really) #143226

Open
@RalfJung

Description

@RalfJung

Attempting to cross-compile something that depends on rustc-dev crates does not work. Even after installing rustc-dev for both the host and the target, the result is >1000 errors, the first ones being:

error[E0463]: can't find crate for `tracing_attributes` which `tracing` depends on
  --> src/lib.rs:53:1
   |
53 | extern crate tracing;
   | ^^^^^^^^^^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `rustc_macros` which `rustc_abi` depends on
  --> src/lib.rs:56:1
   |
56 | extern crate rustc_abi;
   | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
   |
   = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`

error[E0463]: can't find crate for `derive_where` which `rustc_ast` depends on
  --> src/lib.rs:58:1
   |
58 | extern crate rustc_ast;
   | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `rustc_abi`
  --> src/lib.rs:59:1
   |
59 | extern crate rustc_attr_data_structures;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
   |
   = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`

@bjorn3 said:

Yeah, you can't cross-compile projects that use rustc_driver outside of bootstrap. The rustc-dev component only contains proc-macros for the target, while rustc needs them available for the host too.

However, that's why I installed the rustc-dev component both both the current host and the target. Somehow, that's still not enough, and I don't understand why. Does the rustc sysroot not have a concept of "crates for the current target" vs "crates for the host"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions