rust-lang-nursery / lazy-static.rs

A small macro for defining lazy evaluated static variables in Rust.
Apache License 2.0
1.92k stars 111 forks source link

compile error when use lazy_static in a #[no_std] env #187

Closed curtainp closed 3 years ago

curtainp commented 3 years ago

rustc: rustc 1.53.0-nightly compile target:

{
  "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"
}

Cargo config:

# for static instance initialization when first use, but not compile time
[dependencies.lazy_static]
version = "1.0"
feature = ["spin_no_std"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bootloader = "0.9.16"
volatile = "0.2.6"
spin = "0.4.9"

then i use cargo bootimage --target x86_64-unknown-none.json to build minimize kernel, get this error image

curtainp commented 3 years ago

i get it, s