-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Rustdoc: fatal error LNK1181: cannot open input file 'windows.lib'
on windows
#99466
Comments
This is fascinating, I've wanted to add links in markdown files for ages and never thought of using I'm not sure why this would fail and I don't have a windows crate to test - can you rerun rustdoc with RUSTDOC_LOG=rustc_metadata=info so I can see why windows.lib is being loaded? |
also if you can find some way to show the linker command that's being invoked, that would be helpful - I think |
Not sure how I get the rustc_metadata, but here is the complete error:
Edit: added some enters for readability. |
Any news on this? This is reproducible in GitHub Actions on |
So I guess this is because rustdoc is being used directly instead of via cargo so the Windows crate's build script doesn't get to add the library's directory to the linker search path. You'd need to add it manually. It'll be something like: Where |
Thanks! That did the trick: rustdoc src/some_docs.md --test --edition 2018 -L target/debug/deps \
$(cargo metadata -q | jq -r '.packages[] | select(.name == "windows_x86_64_msvc") | .manifest_path' | sed -e 's/^/-L /' -e 's/Cargo.toml/lib/') |
Sounds like this isn't a bug. |
When running UI tests we invoke mutest-driver directly, rather than through Cargo, which means we have to add `windows.lib` to the linker search path manually. See rust-lang/rust#99466 for more details.
While working with rustdoc I have a markdown file with the following contents:
Some docs
running
rustdoc src/some_docs.md --test --edition 2018 -L target/debug/deps
produces the error
= note: LINK : fatal error LNK1181: cannot open input file 'windows.lib'
This happens when I am using the Tokio crate. On Ubuntu and MacOS everything works as expected, on Windows the tests fail in a linking error. Did I do something wrong?
Steps to reproduce
A minimal example:
git clone https://github.com/btielen/rustdocwindows.git
cd rustdocwindows
cargo build
rustdoc src/some_docs.md --test --edition 2018 -L target/debug/deps
Environment
The text was updated successfully, but these errors were encountered: