-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
-Clink-args=resources.res
fails in 1.82
#131995
Comments
Does it work if you pass the full path to the resources.res file? |
I think it worked by accident previously. This should probably be done by adding a parent directory to the search path. E.g.: [target.x86_64-pc-windows-msvc]
rustflags = [
"-Clink-args=resources.res",
"-L./icon",
] Or maybe use a build script to get the path so the argument isn't being passed to everything in the build. |
I've now made a minimum reproduction here: https://github.com/printfn/repro/tree/rust-link-args
Changing it to an absolute file path like Changing it to [target.x86_64-pc-windows-msvc]
rustflags = [
"-Clink-args=resources.res",
"-L./icon",
] causes it to work in my minimal repro, but if I add a dependency with a build script (e.g. |
I guess the current working directory changes for every crate. You could try a build script: // build.rs
fn main() {
println!("cargo::rustc-link-arg-bins=icon/resources.res");
} |
Thanks, a build script works and is probably cleaner anyway. I guess this resolves my issue, though it's still a bit unfortunate that this broke with a minor Rust update. |
Code
In my
.cargo/config.toml
file I have:This used to work in Rust 1.81 but broke on 1.82.
Instead, this happened: See error message below
Minimal reproduction: https://github.com/printfn/repro/tree/rust-link-args
Version it worked on
It most recently worked on: 1.81
Version with regression
rustc --version --verbose
:Detailed error
Error
If I instead run
cargo +1.81 build
it succeeds.Bisection
searched nightlies: from nightly-2024-07-20 to nightly-2024-08-30
regressed nightly: nightly-2024-08-04
searched commit range: fd8d6fb...64ebd39
regressed commit: edc4dc3
bisected with cargo-bisect-rustc v0.6.9
Host triple: x86_64-pc-windows-msvc
Reproduce with:
Bisects to #128370
The text was updated successfully, but these errors were encountered: