New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: oleaut32 not linked #1538
Comments
I am able to link these functions via the |
So I tried making a minimal repro but was unable to, unfortunately. This was originally found in a large closed source repo when I bumped rfd to use the 0.32.0 version in PolyMeilex/rfd#56, and it only happens on a native Windows machine with the regular MSVC toolchain, we didn't observe it happening when cross-compiling from Linux. This is my first encounter with the windows crate so I'm not entirely sure how it works, but I did find it odd that these function are all marked as |
maybe something related to that we (@Jake-Shadle and I work on the same project) use the faster LLD linker instead of the default MSVC linker for our project? |
The https://github.com/microsoft/windows-rs/tree/master/crates/targets/x86_64_msvc/lib All target crates can be found here: https://github.com/microsoft/windows-rs/tree/master/crates/targets That's why it links to "windows" rather than "oleaut32". The change you're noticing is probably #1432 but that was done intentionally to use a consistent lib for all imports. |
Does it repro with the default MSVC toolchain? |
Apparently our project stopped linking via link.exe a while ago due to some kind of resource collision, and we've used lld-link exclusively on windows for 2+ years now and never noticed. |
I haven't tried it myself, but it sounds somewhat experimental. rust-lang/rust#39915 (comment) I'm happy for you to use it but I'm not really a linker expert so can't really suggest what might be wrong. If you can't repro using the MSVC linker then at least you'll know where to begin your research. |
No, that issue is referring to using the rust LLD bundled with the rust compiler, lld-link is the LLD shim that is part of the default clang/LLVM toolchain, and has been stable and producing valid Windows binaries for several versions now. Now that I understand the windows.lib shim thing I'll revert my PR to rfd to add oleaut32 as a link argument since it should work in normal cases and just explicitly add it our project since we already link multiple other SDK libs and thus require it anyways. I think I'll close this issue for now since this seems to be something messed up in our setup, but perhaps someone else will run into a similar issue in the future and we can properly figure it out. |
Which crate is this about?
windows
Crate version
0.32.0
Summary
When building
rfd
from the main branch https://github.com/PolyMeilex/rfd/blob/efc9a28bff7da44785c3aa5b2cbaa097c08339b5/Cargo.toml#L33-L40, we get multiple linker errors for undefined symbols, all of them fromoleaut32.lib
Expected behavior
All relevant libraries should be linked by the windows crate.
Actual behavior
oleaut32.lib is not added as a linker arg, thus linking fails.
Additional comments
I've temporarily fixed this in PolyMeilex/rfd#57 by explicitly adding
oleaut32
to the linker args, but IMO this should be fixed in the windows crate, not downstream crates.The text was updated successfully, but these errors were encountered: