rerunning (or running at any time) cargo build to build the entire workspace results in Rlib errors at runtime
error: crate `rustc_session` required to be available in rlib format, but was not found in this form
|
= help: try adding `extern crate rustc_driver;` at the top level of this crate
error: crate `rustc_ast` required to be available in rlib format, but was not found in this form
|
= help: try adding `extern crate rustc_driver;` at the top level of this crate
error: crate `rustc_span` required to be available in rlib format, but was not found in this form
|
= help: try adding `extern crate rustc_driver;` at the top level of this crate
error: crate `rustc_data_structures` required to be available in rlib format, but was not found in this form
|
= help: try adding `extern crate rustc_driver;` at the top level of this crate
error: crate `ena` required to be available in rlib format, but was not found in this form
error: crate `log` required to be available in rlib format, but was not found in this form
{Clipped}
steps to reproduce (simplified)
I was running in docker run -ti ubuntu /bin/bash but I'm fairly sure the issue will happen on any environment
# 1 install as normal
cargo build --release -p mutest-runtime
cargo install --force --path mutest-driver
cargo install --force --path cargo-mutest
# cargo mutest run where ever you want to test and it works
# 2
cargo build --release
# cargo mutest run where ever you want to test and you get a lot of Rlib errors
# 3
cargo build --release -p mutest-runtime # This from cargo output almost looks like a no-op its clearly loading from a cache
# cargo mutest run where ever you want to test and it works
# you can repeat step 2 at any time and things break again :D and fix after step 3
steps I took in full to repoduce
I was running in docker run -ti ubuntu /bin/bash but I'm fairly sure the issue will happen on any environment
apt update
apt install git rustup gcc
git clone https://github.com/zalanlevai/mutest-rs.git
cd mutest-rs/
rustc --version
######################################## Normal Build install
cargo build --release -p mutest-runtime
cargo install --force --path mutest-driver
cargo install --force --path cargo-mutest
######################################## Setup Test enviroment
cd /
rustup default stable
cargo init mutest_test --lib
cd mutest_test
cat > src/lib.rs << EOF
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
EOF
######################################## cargo mutest run (works as expected)
cargo mutest run
######################################## Build whole workspace
cd /mutest-rs/
cargo build --release
######################################## cargo mutest run (breaks with Rlib errors)
cd -
cargo mutest run
######################################## rebuild runtime and it works
cd -
cargo build --release -p mutest-runtime
cd -
cargo mutest run # Works as expected
I got curious (thinking 1 crate was messing with something) and built every package individually in the following order testing in-between each build if the error appears... it never did
# history | grep "cargo build"
33 cargo build --release --package mutest-runtime-embedded-target-stub
37 cargo build --release --package mutest-runtime-embedded-host-driver
41 cargo build --release --package test-metadata-shim
46 cargo build --release --package mutest-tests
50 cargo build --release --package mutest-operators
54 cargo build --release --package mutest-json
58 cargo build --release --package mutest-emit
62 cargo build --release --package mutest-driver-cli
66 cargo build --release --package mutest-driver
70 cargo build --release --package cargo-mutest
after all of above i reran cargo build --release and errors came straight back :D
Found the issue because packaging it for nix I kept running cargo build --release -p mutest-runtime then thinking i could save a command and just run cargo build --release thinking oh it just builds everything then jobs a good'n' but hit errors at runtime, found the issue way more interesting when i realised it would break the cargo install command :D
rerunning (or running at any time)
cargo buildto build the entire workspace results in Rlib errors at runtimesteps to reproduce (simplified)
I was running in
docker run -ti ubuntu /bin/bashbut I'm fairly sure the issue will happen on any environmentsteps I took in full to repoduce
I was running in
docker run -ti ubuntu /bin/bashbut I'm fairly sure the issue will happen on any environmentI got curious (thinking 1 crate was messing with something) and built every package individually in the following order testing in-between each build if the error appears... it never did
after all of above i reran
cargo build --releaseand errors came straight back :DFound the issue because packaging it for nix I kept running
cargo build --release -p mutest-runtimethen thinking i could save a command and just runcargo build --releasethinking oh it just builds everything then jobs a good'n' but hit errors at runtime, found the issue way more interesting when i realised it would break thecargo installcommand :D