I have this repo cloned on my Ubuntu 22.04 instance: https://gitlab.conclusive.pl/devices/ubuntu-build
and I'm trying to run:
git submodule update --init --recursive
sudo make image PROFILE=kstr-sama5d27
I receive the following error:
error[E0658]: use of unstable library feature 'scoped_threads' --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-deb-1.41.3/src/data.rs:128:5 | 128 | std::thread::scope(move |s| { | ^^^^^^^^^^^^^^^^^^ | = note: see issue #93203 https://github.com/rust-lang/rust/issues/93203 for more information
error[E0658]: use of unstable library feature 'scoped_threads' --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-deb-1.41.3/src/data.rs:130:29 | 130 | let hash_thread = s.spawn(move || { | ^^^^^ | = note: see issue #93203 https://github.com/rust-lang/rust/issues/93203 for more information
error[E0658]: use of unstable library feature 'scoped_threads' --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-deb-1.41.3/src/data.rs:162:24 | 162 | Ok(hash_thread.join().unwrap()) | ^^^^ | = note: see issue #93203 https://github.com/rust-lang/rust/issues/93203 for more information
For more information about this error, try
rustc --explain E0658
. error: could not compilecargo-deb
due to 3 previous errors warning: build failed, waiting for other jobs to finish... error: failed to compilegpt-manipulator v0.1.0 (/home/davidg/kstr-ubuntu-build/build-kstr-sama5d27/gpt-manipulator)
, intermediate artifacts can be found at/home/davidg/kstr-ubuntu-build/build-kstr-sama5d27/gpt-manipulator/target
make: *** [Makefile:106: gpt-manipulator] Error 101
There's been no change to the source code since the last time this worked so my suspicion is something external has changed. I performed grep -r "thread::scope" .
in the repo and found no uses of this unstable feature.
The gpt-manipulator submodule repo having the build error is https://gitlab.conclusive.pl/devices/gpt-manipulator and I can cargo build
from this repo without issue.
Note that my environment is prepared using sudo apt-get install bc libssl-dev cargo gdisk mtools
. This installs rust&cargo system-wide and allows sudo to access it (needed by sudo make image
). I read that using rustup
install method I can switch to nightly and allow the unstable feature but installing this way sudo can't find the binaries.
cargo --version
and rustc --version
both report 1.61.0
How can I successfully build this?
CodePudding user response:
Scoped threads have been stabilized in 1.63 so some dependency might be using it now. If you're running an earlier compiler it will complain about that usage though. A rustup update
or the equivalent for what you use to update Rust should fix this.
CodePudding user response:
The command that's failing is actually cargo install cargo-deb
. It appears the latest version uses scoped threads.
As a workaround, you can install a specific older version:
cargo install cargo-deb --version 1.28.2
Might want to use 1.28.2
to match the version you say is in Cargo.toml
, otherwise it looks like 1.40.5
is the last version not using std::thread::scope
.
CodePudding user response:
Per @cafce25's answer, scoped threads are stabilized in 1.63.0, however at present apt is limited to supplying 1.61.0.
To obtain a version >= 1.63.0 that can be run with sudo:
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sudo sh
- append secure_path in /etc/sudoers with
:/root/.cargo/bin