Skip to content

AVR CPU not explicitly specified #140714

@kitt159

Description

@kitt159

Code

Cargo.toml

[package]
name = "arduino_test"
version = "0.1.0"
edition = "2024"

src/main.rs

fn main() {}

rust-toolchain.toml

[toolchain]
channel = "nightly"

.cargo/config.toml

[build]
target = "avr-atmega168.json"

[unstable]
build-std = ["core"]

avr-atmega168.json

{
  "arch": "avr",
  "atomic-cas": false,
  "cpu": "atmega168",
  "crt-objects-fallback": "false",
  "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8",
  "eh-frame-header": false,
  "exe-suffix": ".elf",
  "late-link-args": {
    "gnu-cc": [
      "-lgcc"
    ],
    "gnu-lld-cc": [
      "-lgcc"
    ]
  },
  "linker": "avr-gcc",
  "linker-flavor": "gnu-cc",
  "llvm-target": "avr-unknown-unknown",
  "max-atomic-width": 8,
  "metadata": {
    "description": null,
    "host_tools": null,
    "std": null,
    "tier": null
  },
  "no-default-libraries": false,
  "pre-link-args": {
    "gnu-cc": [
      "-mmcu=atmega168",
      "-Wl,--as-needed,--print-memory-usage"
    ],
    "gnu-lld-cc": [
      "-mmcu=atmega168",
      "-Wl,--as-needed,--print-memory-usage"
    ]
  },
  "relocation-model": "static",
  "target-c-int-width": "16",
  "target-pointer-width": "16"
}

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (2e6882ac5 2025-05-05)
binary: rustc
commit-hash: 2e6882ac5be27a73293d6f7ae56397fdf32848de
commit-date: 2025-05-05
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.4

Error output

   Compiling core v0.0.0 (/home/kitt159/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling compiler_builtins v0.1.157
   Compiling rustc-std-workspace-core v1.99.0 (/home/kitt159/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)

thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/metadata.rs:356:17:
compiler/rustc_codegen_ssa/src/back/metadata.rs:356:17: AVR CPU not explicitly specified
stack backtrace:
   0:     0x7ebf90b156c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd3e873d239b5b5e2
   1:     0x7ebf912059c7 - core::fmt::write::hfd6085db4fd41216
   2:     0x7ebf92267d51 - std::io::Write::write_fmt::h073efe5ecef8729b
   3:     0x7ebf90b15522 - std::sys::backtrace::BacktraceLock::print::hd38f341876bcb8ab
   4:     0x7ebf90b1936a - std::panicking::default_hook::{{closure}}::h1e861ed76f9a23da
   5:     0x7ebf90b18eef - std::panicking::default_hook::hac2ae98bda58995a
   6:     0x7ebf8fb5af33 - std[995b4f30a5f93ab3]::panicking::update_hook::<alloc[b64cbe487e4a96db]::boxed::Box<rustc_driver_impl[3f4e6dd15364d482]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7ebf90b19be3 - std::panicking::rust_panic_with_hook::hd97805360ae511f3
   8:     0x7ebf9016d972 - std[995b4f30a5f93ab3]::panicking::begin_panic::<alloc[b64cbe487e4a96db]::string::String>::{closure#0}
   9:     0x7ebf90169696 - std[995b4f30a5f93ab3]::sys::backtrace::__rust_end_short_backtrace::<std[995b4f30a5f93ab3]::panicking::begin_panic<alloc[b64cbe487e4a96db]::string::String>::{closure#0}, !>
  10:     0x7ebf901685f2 - std[995b4f30a5f93ab3]::panicking::begin_panic::<alloc[b64cbe487e4a96db]::string::String>
  11:     0x7ebf901fe507 - rustc_middle[cfb36c9f7626d740]::util::bug::opt_span_bug_fmt::<rustc_span[3d5febd1743f0981]::span_encoding::Span>::{closure#0}
  12:     0x7ebf901d6d2a - rustc_middle[cfb36c9f7626d740]::ty::context::tls::with_opt::<rustc_middle[cfb36c9f7626d740]::util::bug::opt_span_bug_fmt<rustc_span[3d5febd1743f0981]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7ebf901d6b9b - rustc_middle[cfb36c9f7626d740]::ty::context::tls::with_context_opt::<rustc_middle[cfb36c9f7626d740]::ty::context::tls::with_opt<rustc_middle[cfb36c9f7626d740]::util::bug::opt_span_bug_fmt<rustc_span[3d5febd1743f0981]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7ebf8d47dab0 - rustc_middle[cfb36c9f7626d740]::util::bug::bug_fmt
  15:     0x7ebf92fd071f - rustc_codegen_ssa[b274b309e1d14490]::back::metadata::elf_e_flags.cold
  16:     0x7ebf92480df8 - rustc_codegen_ssa[b274b309e1d14490]::back::metadata::create_object_file
  17:     0x7ebf9248136a - rustc_codegen_ssa[b274b309e1d14490]::back::metadata::create_wrapper_file
  18:     0x7ebf921a5810 - rustc_codegen_ssa[b274b309e1d14490]::back::link::link_rlib
  19:     0x7ebf92012b72 - rustc_codegen_ssa[b274b309e1d14490]::back::link::link_binary
  20:     0x7ebf9228ae63 - <rustc_interface[74411b91f4b0d378]::queries::Linker>::link
  21:     0x7ebf9227d3f5 - rustc_interface[74411b91f4b0d378]::interface::run_compiler::<(), rustc_driver_impl[3f4e6dd15364d482]::run_compiler::{closure#0}>::{closure#1}
  22:     0x7ebf9225e9be - std[995b4f30a5f93ab3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[74411b91f4b0d378]::util::run_in_thread_with_globals<rustc_interface[74411b91f4b0d378]::util::run_in_thread_pool_with_globals<rustc_interface[74411b91f4b0d378]::interface::run_compiler<(), rustc_driver_impl[3f4e6dd15364d482]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  23:     0x7ebf9225ee34 - <<std[995b4f30a5f93ab3]::thread::Builder>::spawn_unchecked_<rustc_interface[74411b91f4b0d378]::util::run_in_thread_with_globals<rustc_interface[74411b91f4b0d378]::util::run_in_thread_pool_with_globals<rustc_interface[74411b91f4b0d378]::interface::run_compiler<(), rustc_driver_impl[3f4e6dd15364d482]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[45498fa80790190e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7ebf9226022b - std::sys::pal::unix::thread::Thread::new::thread_start::hb0f75c01927b9bd8
  25:     0x7ebf8c0a57eb - <unknown>
  26:     0x7ebf8c12918c - <unknown>
  27:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

warning: the ICE couldn't be written to `/home/kitt159/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core/rustc-ice-2025-05-06T19_28_50-82506.txt`: Permission denied (os error 13)

note: rustc 1.88.0-nightly (2e6882ac5 2025-05-05) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -Z force-unstable-if-unmarked

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `rustc-std-workspace-core` (lib)

Caused by:
  process didn't exit successfully: `/home/kitt159/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name rustc_std_workspace_core --edition=2024 /home/kitt159/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=212 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=d69dbeb2f00d9bc9 -C extra-filename=-b0ccda204ffa2437 --out-dir /tmp/ice/target/avr-atmega168/debug/deps --target /tmp/ice/avr-atmega168.json -Z force-unstable-if-unmarked -L dependency=/tmp/ice/target/avr-atmega168/debug/deps -L dependency=/tmp/ice/target/debug/deps --extern core=/tmp/ice/target/avr-atmega168/debug/deps/libcore-b4238c2e9d4106ec.rmeta --cap-lints allow` (exit status: 101)
warning: build failed, waiting for other jobs to finish...
error[E0432]: unresolved import `core::sync::atomic::AtomicU32`
 --> /home/kitt159/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/compiler_builtins-0.1.157/src/math/libm_math/support/feature_detect.rs:3:26
  |
3 | use core::sync::atomic::{AtomicU32, Ordering};
  |                          ^^^^^^^^^
  |                          |
  |                          no `AtomicU32` in `sync::atomic`
  |                          help: a similar name exists in the module: `AtomicU8`


thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/metadata.rs:356:17:
compiler/rustc_codegen_ssa/src/back/metadata.rs:356:17: AVR CPU not explicitly specified
stack backtrace:
   0:     0x7fe605b156c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd3e873d239b5b5e2
   1:     0x7fe6062059c7 - core::fmt::write::hfd6085db4fd41216
   2:     0x7fe607267d51 - std::io::Write::write_fmt::h073efe5ecef8729b
   3:     0x7fe605b15522 - std::sys::backtrace::BacktraceLock::print::hd38f341876bcb8ab
   4:     0x7fe605b1936a - std::panicking::default_hook::{{closure}}::h1e861ed76f9a23da
   5:     0x7fe605b18eef - std::panicking::default_hook::hac2ae98bda58995a
   6:     0x7fe604b5af33 - std[995b4f30a5f93ab3]::panicking::update_hook::<alloc[b64cbe487e4a96db]::boxed::Box<rustc_driver_impl[3f4e6dd15364d482]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7fe605b19be3 - std::panicking::rust_panic_with_hook::hd97805360ae511f3
   8:     0x7fe60516d972 - std[995b4f30a5f93ab3]::panicking::begin_panic::<alloc[b64cbe487e4a96db]::string::String>::{closure#0}
   9:     0x7fe605169696 - std[995b4f30a5f93ab3]::sys::backtrace::__rust_end_short_backtrace::<std[995b4f30a5f93ab3]::panicking::begin_panic<alloc[b64cbe487e4a96db]::string::String>::{closure#0}, !>
  10:     0x7fe6051685f2 - std[995b4f30a5f93ab3]::panicking::begin_panic::<alloc[b64cbe487e4a96db]::string::String>
  11:     0x7fe6051fe507 - rustc_middle[cfb36c9f7626d740]::util::bug::opt_span_bug_fmt::<rustc_span[3d5febd1743f0981]::span_encoding::Span>::{closure#0}
  12:     0x7fe6051d6d2a - rustc_middle[cfb36c9f7626d740]::ty::context::tls::with_opt::<rustc_middle[cfb36c9f7626d740]::util::bug::opt_span_bug_fmt<rustc_span[3d5febd1743f0981]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7fe6051d6b9b - rustc_middle[cfb36c9f7626d740]::ty::context::tls::with_context_opt::<rustc_middle[cfb36c9f7626d740]::ty::context::tls::with_opt<rustc_middle[cfb36c9f7626d740]::util::bug::opt_span_bug_fmt<rustc_span[3d5febd1743f0981]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7fe60247dab0 - rustc_middle[cfb36c9f7626d740]::util::bug::bug_fmt
  15:     0x7fe607fd071f - rustc_codegen_ssa[b274b309e1d14490]::back::metadata::elf_e_flags.cold
  16:     0x7fe607480df8 - rustc_codegen_ssa[b274b309e1d14490]::back::metadata::create_object_file
  17:     0x7fe60748136a - rustc_codegen_ssa[b274b309e1d14490]::back::metadata::create_wrapper_file
  18:     0x7fe6071a5810 - rustc_codegen_ssa[b274b309e1d14490]::back::link::link_rlib
  19:     0x7fe607012b72 - rustc_codegen_ssa[b274b309e1d14490]::back::link::link_binary
  20:     0x7fe60728ae63 - <rustc_interface[74411b91f4b0d378]::queries::Linker>::link
  21:     0x7fe60727d3f5 - rustc_interface[74411b91f4b0d378]::interface::run_compiler::<(), rustc_driver_impl[3f4e6dd15364d482]::run_compiler::{closure#0}>::{closure#1}
  22:     0x7fe60725e9be - std[995b4f30a5f93ab3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[74411b91f4b0d378]::util::run_in_thread_with_globals<rustc_interface[74411b91f4b0d378]::util::run_in_thread_pool_with_globals<rustc_interface[74411b91f4b0d378]::interface::run_compiler<(), rustc_driver_impl[3f4e6dd15364d482]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  23:     0x7fe60725ee34 - <<std[995b4f30a5f93ab3]::thread::Builder>::spawn_unchecked_<rustc_interface[74411b91f4b0d378]::util::run_in_thread_with_globals<rustc_interface[74411b91f4b0d378]::util::run_in_thread_pool_with_globals<rustc_interface[74411b91f4b0d378]::interface::run_compiler<(), rustc_driver_impl[3f4e6dd15364d482]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[45498fa80790190e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7fe60726022b - std::sys::pal::unix::thread::Thread::new::thread_start::hb0f75c01927b9bd8
  25:     0x7fe6010a57eb - <unknown>
  26:     0x7fe60112918c - <unknown>
  27:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

warning: the ICE couldn't be written to `/home/kitt159/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/rustc-ice-2025-05-06T19_28_45-82465.txt`: Permission denied (os error 13)

note: rustc 1.88.0-nightly (2e6882ac5 2025-05-05) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -Z force-unstable-if-unmarked

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `core` (lib)

Caused by:
  process didn't exit successfully: `/home/kitt159/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name core --edition=2024 /home/kitt159/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=212 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --warn=unexpected_cfgs --check-cfg 'cfg(bootstrap)' --check-cfg 'cfg(no_fp_fmt_parse)' --check-cfg 'cfg(feature, values(any()))' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("debug_refcell", "debug_typeid", "optimize_for_size", "panic_immediate_abort"))' -C metadata=96ac5840e8b52e74 -C extra-filename=-b4238c2e9d4106ec --out-dir /tmp/ice/target/avr-atmega168/debug/deps --target /tmp/ice/avr-atmega168.json -Z force-unstable-if-unmarked -L dependency=/tmp/ice/target/avr-atmega168/debug/deps -L dependency=/tmp/ice/target/debug/deps --cap-lints allow` (exit status: 101)
For more information about this error, try `rustc --explain E0432`.
error: could not compile `compiler_builtins` (lib) due to 1 previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-AVRTarget: AVR processors (ATtiny, ATmega, etc.)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions