dtolnay / inventory

Typed distributed plugin registration
Apache License 2.0
948 stars 43 forks source link

Unknown symbols during linking on `x86_64-pc-windows-msvc` as of Rust 1.65.0 #58

Closed jszwedko closed 9 months ago

jszwedko commented 1 year ago

When trying to upgrade to Rust 1.65.0 for https://github.com/vectordotdev/vector, which uses this crate, we ran into linking issues on x86_64-pc-windows-msvc (build.log; this log is for 1.66.0 but we ran into the same issue on Rust 1.65.0).

Snippet of log:

2022-12-22T22:49:37.6937344Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms13log_to_metric1_25__init___rust_ctor___ctor17h64d5fc6fb99d330aE
2022-12-22T22:49:37.6937846Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms13metric_to_log1_25__init___rust_ctor___ctor17hbeda55e3bf00e4d5E
2022-12-22T22:49:37.6938346Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms16aws_ec2_metadata1_25__init___rust_ctor___ctor17hb8a3426c861b211fE
2022-12-22T22:49:37.6938859Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms21tag_cardinality_limit6config1_25__init___rust_ctor___ctor17hd0b137b0bdff8d2bE
2022-12-22T22:49:37.6939360Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms3lua1_25__init___rust_ctor___ctor17h4040d0e162d8878bE
2022-12-22T22:49:37.6939835Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms5remap1_25__init___rust_ctor___ctor17h50b8ee216976026eE
2022-12-22T22:49:37.6940305Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms5route1_25__init___rust_ctor___ctor17hadc171e492e47a2dE
2022-12-22T22:49:37.6940776Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms6dedupe1_25__init___rust_ctor___ctor17hf2bef12f5768630dE
2022-12-22T22:49:37.6941259Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms6filter1_25__init___rust_ctor___ctor17hf000e1c6bb14d353E
2022-12-22T22:49:37.6941730Z           symbols.o : error LNK2001: unresolved external symbol _ZN6vector10transforms6reduce1_25__init___rust_ctor___ctor17hb0a0d85dc4d65beaE

I was able to bisect rustc changes down to this commit: https://github.com/rust-lang/rust/commit/4916e2b9e6ef8cee6f9c6abb75bd01ba9dc07e5c.

I can try to come up with a more minimal MRE if it is helpful. I figured something about that rustc commit might jump out though.

jszwedko commented 1 year ago

Running with codegen-units = 1 seems to resolve it 🤔

dtolnay commented 9 months ago

I think this would need to be reported with a MRE (not involving macros) to rust-lang/rust. I don't know of anything in the inventory crate or ctor crate that would lead to an error like this.