Skip to content
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

v0.3.74 fails to build on Windows #676

Closed
KapJI opened this issue Nov 11, 2024 · 7 comments · Fixed by #677
Closed

v0.3.74 fails to build on Windows #676

KapJI opened this issue Nov 11, 2024 · 7 comments · Fixed by #677

Comments

@KapJI
Copy link

KapJI commented Nov 11, 2024

Here are the errors: backtrace-errors.txt

We are building project with buck2 but third party dependencies are resolved and vendored by cargo.

Is windows-sys dependency wrong?

v0.3.73 and below work fine. Other platforms seems to be ok as well.

@ChrisDenton
Copy link
Member

ChrisDenton commented Nov 11, 2024

We don't use the windows-sys crate, we use windows-bindgen to pre-generate our own windows_sys.rs module. We do have a dependency on windows-targets though.

The errors look like they come from our code that tries to validate that the APIs are correct (aisde: this code is probably redundant now we're not hand-writing anything). This is failing for you for some reason but not for our CI (or in the rust-lang/rust repo). My guess would be you're using the windows raw dylib environment variable and that's causing a difference somewhere.

@KapJI
Copy link
Author

KapJI commented Nov 11, 2024

I can bisect it to specific commit tomorrow.

@ChrisDenton
Copy link
Member

Following up on my hunch it seems that the windows-targets crate using extern "C" for all ABIs on 64-bit systems when windows_raw_dylib is used https://github.com/microsoft/windows-rs/blob/a8e14c75581bb89fc244ad480f98567be972aea2/crates/libs/targets/src/lib.rs#L23C9-L23C10 which would account for the ABI mismatch assertions failing. I seem to recall there was a reason for that, but I can't quite remember. I guess it's because all the x86 ABIs just resolve to extern "C" on x64 and arm64.

@KapJI
Copy link
Author

KapJI commented Nov 11, 2024

We add windows_raw_dylib to windows-targets indeed. But it was there before that as well and backtrace build was passing. What has changed with the latest release? For builds we have regular windows-latest Github runner.

@KapJI
Copy link
Author

KapJI commented Nov 12, 2024

Bisected to #653 which added dependency of windows-targets.

@dtolnay
Copy link
Member

dtolnay commented Nov 13, 2024

Non-Buck repro, as of the current master branch of this repo (4f3acf7):

rustup target add x86_64-pc-windows-msvc
RUSTFLAGS=--cfg=windows_raw_dylib cargo check --target x86_64-pc-windows-msvc

@ChrisDenton
Copy link
Member

I seem to recall there was a reason for that,

Ah jogged my memory: this was because of microsoft/windows-rs#2458. Varargs weren't being correctly handled by rustc so this was a workaround. It's been fixed in rustc now but the MSRV of windows-related crates means it's unlikely to revert the workaround any time soon. So best thing to do would be to update our validation or remove them entirely if nobody can think of a reason why they're still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants