Skip to content

Commit

Permalink
fix: rust 1.81 toolchain build issue (#1534)
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI authored Sep 23, 2024
1 parent 8e82b81 commit 25cdde5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/cli/src/commands/build_toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,24 @@ impl BuildToolchainCmd {
std::fs::write(&config_file, config_toml)
.with_context(|| format!("while writing configuration to {:?}", config_file))?;

// Work around target sanity check added in rust-lang/rust@09c076810cb7649e5817f316215010d49e78e8d7.
let temp_dir = std::env::temp_dir().join("rustc-targets");
if !temp_dir.exists() {
std::fs::create_dir_all(&temp_dir)?;
}
std::fs::File::create(temp_dir.join("riscv32im-succinct-zkvm-elf.json"))?;

// Build the toolchain (stage 1).
Command::new("python3")
.env("RUST_TARGET_PATH", &temp_dir)
.env("CARGO_TARGET_RISCV32IM_SUCCINCT_ZKVM_ELF_RUSTFLAGS", "-Cpasses=loweratomic")
.args(["x.py", "build"])
.current_dir(&rust_dir)
.run()?;

// Build the toolchain (stage 2).
Command::new("python3")
.env("RUST_TARGET_PATH", &temp_dir)
.env("CARGO_TARGET_RISCV32IM_SUCCINCT_ZKVM_ELF_RUSTFLAGS", "-Cpasses=loweratomic")
.args(["x.py", "build", "--stage", "2"])
.current_dir(&rust_dir)
Expand Down

0 comments on commit 25cdde5

Please sign in to comment.