Compile hyper-v program erro

git clone GitHub - equation314/RVM-Tutorial: Let's write an x86 hypervisor in Rust from scratch!
cd RVM-Tutorial/
git checkout step0
make run

erro info:
cargo build --target x86_64.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem --release
Compiling core v0.0.0 (/home/zevorn/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling rustc-std-workspace-core v1.99.0 (/home/zevorn/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Compiling compiler_builtins v0.1.125
error: data-layout for target x86_64-11597790947565730434, e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128, differs from LLVM target's x86_64-unknown-none default layout, e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128

error: could not compile rustc-std-workspace-core (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile core (lib) due to 1 previous error
error: could not compile compiler_builtins (lib) due to 1 previous error
make: *** [Makefile:44: elf] Error 101

current rust verison with my env:
rustc --version
rustc 1.83.0-nightly (7042c269c 2024-09-23)

The target spec json in that tutorial hasn't been updated for latest rustc. Try using the builtin x86_64-unknown-none target instead using --target x86_64-unknown-none instead of x86_64.json.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.