Closed as not planned
Closed as not planned
Description
Problem
In our project, we are using rustc
components. When building for a x86_64
target it's fine. However, when setting the target to i686-unknown-linux-gnu
, cargo (rustc) starts complaining about components not existing.
I think this is a problem due to components installation through rustup
. It doesn't look to be installing them for the specified target.
The initial install is done through the following command.
$> rustup toolchain install nightly-2023-01-26 --target i686-unknown-linux-gnu --component rust-src rustc-dev llvm-tools-preview
info: syncing channel updates for 'nightly-2023-01-26-x86_64-unknown-linux-gnu'
info: latest update on 2023-01-26, rust version 1.69.0-nightly (c18a5e8a5 2023-01-25)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'llvm-tools'
info: downloading component 'rust-docs'
info: downloading component 'rust-src'
info: downloading component 'rust-std' for 'i686-unknown-linux-gnu'
info: downloading component 'rust-std'
info: downloading component 'rustc'
68.3 MiB / 68.3 MiB (100 %) 45.8 MiB/s in 1s ETA: 0s
info: downloading component 'rustc-dev'
111.1 MiB / 111.1 MiB (100 %) 44.5 MiB/s in 2s ETA: 0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'llvm-tools'
32.8 MiB / 32.8 MiB (100 %) 23.6 MiB/s in 1s ETA: 0s
info: installing component 'rust-docs'
19.4 MiB / 19.4 MiB (100 %) 17.7 MiB/s in 1s ETA: 0s
info: installing component 'rust-src'
info: installing component 'rust-std' for 'i686-unknown-linux-gnu'
28.1 MiB / 28.1 MiB (100 %) 20.7 MiB/s in 1s ETA: 0s
info: installing component 'rust-std'
30.1 MiB / 30.1 MiB (100 %) 20.5 MiB/s in 1s ETA: 0s
info: installing component 'rustc'
68.3 MiB / 68.3 MiB (100 %) 23.2 MiB/s in 2s ETA: 0s
info: installing component 'rustc-dev'
111.1 MiB / 111.1 MiB (100 %) 21.6 MiB/s in 5s ETA: 0s
info: installing component 'rustfmt'
nightly-2023-01-26-x86_64-unknown-linux-gnu installed - rustc 1.69.0-nightly (c18a5e8a5 2023-01-25)
However, during building rustup complaints as follows.
$> cargo build --target=i686-unknown-linux-gnu
...
error[E0463]: can't find crate for `rustc_middle`
--> compiler/src/lib.rs:19:1
|
19 | extern crate rustc_middle;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
Trying to install components again raises a conflict issue.
$> rustup component add --target i686-unknown-linux-gnu rust-src rustc-dev llvm-tools-preview
info: component 'rust-src' is up to date
info: downloading component 'rustc-dev' for 'i686-unknown-linux-gnu'
info: installing component 'rustc-dev' for 'i686-unknown-linux-gnu'
128.4 MiB / 128.4 MiB (100 %) 21.6 MiB/s in 5s ETA: 0s
info: rolling back changes
error: failed to install component: 'rustc-dev-i686-unknown-linux-gnu', detected conflict: 'lib/rustlib/rustc-src/rust/Cargo.lock'
Originally, we are using rust-toolchain.toml
to define the components and targets. In both cases, these issues exist. Also tried installing it side by side the x86_64
target and the same issue exists.
Steps
- Create a project using
rustc
components. - Create a
rust-toolchain.toml
to override the toolchain and define components and targets as follows.
[toolchain]
channel = "nightly-2023-01-26"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
targets = ["i686-unknown-linux-gnu"]
- Build using
cargo build --target=i686-unknown-linux-gnu
.
Possible Solution(s)
No response
Notes
No response
Rustup version
rustup 1.25.2 (17db695f1 2023-02-01)
Installed toolchains
Default host: x86_64-unknown-linux-gnu
rustup home: ...
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu
nightly-2023-01-26-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
installed targets for active toolchain
--------------------------------------
i686-unknown-linux-gnu
x86_64-unknown-linux-gnu
active toolchain
----------------
nightly-2023-01-26-x86_64-unknown-linux-gnu (overridden by '.../rust-toolchain.toml')
rustc 1.69.0-nightly (c18a5e8a5 2023-01-25)