-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-windowsOperating system: WindowsOperating system: Windows
Description
rustc 1.94.0-nightly (37aa2135b 2025-12-08)
.cargo/config.toml
opt-level = 0 # 关闭优化 加快编译
panic = "unwind" # 开启 panic 处理 -> 避免运行时错误
lto = "off" # 禁用链接时优化
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
codegen-backend = "cranelift"
rustflags = [
"-C",
"prefer-dynamic",
- If use msvc linker rather than rust-lld , the error still exist
- If i don't use "prefer-dynamic", the error disappear
use std::io::{self, Write};
fn main() {
eprintln!("This is an error message to stderr");
let mut stderr = io::stderr();
writeln!(stderr, "Another stderr message").expect("Failed to write to stderr");
println!("This is normal output to stdout");
}Link Error
error: linking with `rust-lld.exe` failed: exit code: 1
|
= note: "rust-lld.exe" "-flavor" "link" "/NOLOGO" "D:\\Temp\\rustcSoEzPa\\symbols.o" "<15 object files omitted>" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\std-4e1e2ae26c8967c0.dll.lib" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/libcompiler_builtins-*.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "D:\\Temp\\rustcSoEzPa\\api-ms-win-core-synch-l1-2-0.dll_imports_indirect.lib" "D:\\Temp\\rustcSoEzPa\\bcryptprimitives.dll_imports_indirect.lib" "/NXCOMPAT" "/OUT:D:\\project\\target\\debug\\deps\\project.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: rust-lld: error: undefined symbol: std::io::stdio::stderr::INSTANCE
>>> referenced by D:\project\target\debug\deps\project.5rcvp1v3l83aolc4wpj6y2vwk.19skkgm.rcgu.o:(.refptr._RNvNvNtNtCsaVqoImmYiGb_3std2io5stdio6stderr8INSTANCE)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-windowsOperating system: WindowsOperating system: Windows