-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
A-lldArea: Linkage issues specific to rust-lldArea: Linkage issues specific to rust-lldC-external-bugCategory: issue that is caused by bugs in software beyond our controlCategory: issue that is caused by bugs in software beyond our control
Description
I created a new library using cargo new --lib testlib and turned it into a proc-macro by adding
[lib]
proc-macro = true
to its Cargo.toml. I also emptied its lib.rs.
Using nightly-2025-12-08-x86_64-pc-windows-gnullvm with RUSTFLAGS=-Clinker=rust-lld (as recommended in #146634 (comment)), I try to build it via cargo build.
I'm reproducibly getting the error:
Compiling testlib v0.1.0 (C:\Users\Colin\testlib)
error: linking with `rust-lld` failed: exit code: 1
|
= note: "rust-lld" "-flavor" "gnu" "C:\\Users\\Colin\\AppData\\Local\\Temp\\rustcp7FqZO\\list.def" "-m" "i386pep" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-gnullvm\\lib\\self-contained\\dllcrt2.o" "C:\\Users\\Colin\\AppData\\Local\\Temp\\rustcp7FqZO\\symbols.o" "<1 object files omitted>" "C:\\Users\\Colin\\AppData\\Local\\Temp\\rustcp7FqZO\\rmeta.o" "<1 object files omitted>" "-Bstatic" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-gnullvm\\lib/{libproc_macro-*,librustc_literal_escaper-*,librustc_std_workspace_std-*,libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Bdynamic" "-lkernel32" "-lkernel32" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-ldbghelp" "-lunwind" "-lmingw32" "-lmingwex" "-lmsvcrt" "-lkernel32" "-luser32" "--nxcompat" "-L" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-gnullvm\\lib\\self-contained" "-o" "C:\\Users\\Colin\\testlib\\target\\debug\\deps\\testlib-0a32fbaff21869e9.dll" "--gc-sections" "-shared" "--out-implib=C:\\Users\\Colin\\testlib\\target\\debug\\deps\\libtestlib-0a32fbaff21869e9.dll.a"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: rust-lld: error: <root>: undefined symbol: _DllMainCRTStartup
This works fine for the x86_64-pc-windows-msvc target.
CC @mati865
Metadata
Metadata
Assignees
Labels
A-lldArea: Linkage issues specific to rust-lldArea: Linkage issues specific to rust-lldC-external-bugCategory: issue that is caused by bugs in software beyond our controlCategory: issue that is caused by bugs in software beyond our control