Description
When I start study VGA Text Mode
and add dependency for volatile
, My project start got error like this
│WARNING: You're currently building for the host system. This is likely an error and will cause build scripts of dependencies to break.
│
│To build for the target system either pass a `--target` argument or set the build.target configuration key in a `.cargo/config` file.
│
│ Compiling core v0.0.0 (/Users/xunjunjie/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core)
│ Compiling compiler_builtins v0.1.70
│error: unknown `--json` option `future-incompat`
│error: unknown `--json` option `future-incompat`
│error: unknown `--json` option `future-incompat`
│
│
│
│error: could not compile `compiler_builtins`
│warning: build failed, waiting for other jobs to finish...
│error: build failed
Even if I delete the volatile
dependency, or even delete the entire project and start all over again, it will not return to normal, and my project can successfully print characters in pemu
before the volatile
event follows the tutorial
Please HELP~
My .cargo/config.toml
in project
cfg(target_os = "linux")']
rustflags = ["-C", "link-arg=-nostartfiles"]
[target.'cfg(target_os = "windows")']
rustflags = ["-C", "link-args=/ENTRY:_start /SUBSYSTEM:console"]
[target.'cfg(target_os = "macos")']
rustflags = ["-C", "link-args=-e __start -static -nostartfiles"]
[unstable]
build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins"]
[build]
target = "x86_64-blog_os.json"
My main.rs
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
#[no_mangle]
pub extern "C" fn _start() -> ! {
loop {}
}
My Cargo.toml
[package]
name = "blog_os_study"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"
my json
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"arch": "x86_64",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"os": "none",
"executables": true,
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"panic-strategy": "abort",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float"
}
What confuse me the most was the error: unknown '--json' option 'future-incompat'
this error, which I had never seen before and did not get much help from searching
My computer is Macbook Pro
Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
macOS Monterey 12.21
By the way, A Freestanding Rust Binary
This chapter is consistent with the tutorial and the correct output