-
Notifications
You must be signed in to change notification settings - Fork 42
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
Invalid resource file generated on MSVC #3
Comments
Just make sure you use
This won't work as a normal build script because rustc forces the extension on input files to be |
If this RFC was accepted and implemented, you'd be able to link the |
This is actually what I want but cargo would not let me do it. It insists on adding .lib to any name added by the build script.
I wanted to avoid calling unnecessary programs. But according to servo/servo#11969 (comment) this seems to be the only solution. Ideally cargo would let me add arbitrary options to the linker command line from the build script, but this is not possible. Edit: It could be possible, see rust-lang/rfcs#1766 but it seem highly unlikley this will ever be added in any non nightly versions. |
Okay, so after some testing here are the results. Using
In conclusion the only solution at this point in time is to create a |
Does this mean we can still utilize winres for building the icon file? |
Well, as @retep998 explained the only way is naming the compiled resource file "*.lib". And this is exactly what the current version of winres does. Try it out, setting an icon (.ico file) should work perfectly. |
|
Yes, bundling it into the rlib is what was causing us problems. Rust would check that it was actually a .lib, which was breaking the servo build in @Coder206's PR. |
@Coder206 go ahead, I'd like to have a PR. As to @larsbergstrom's comment I've never considered that someone would use winres to build an rlib, I've only tested it for the use build scripts of binaries (.exes and .dlls) |
I've published version 0.1.1 on crates.io. This version includes the fix proposed by @retep998 |
Could you perhaps also push the commit with the fix to github? |
Thanks everyone! |
This came up in the context of Servo:
servo/servo#11969 (comment)
Basically, the issue is that the MSVC codepath uses
res
to create a .res file, but just renames it to .lib:https://github.com/mxre/winres/blob/master/lib.rs#L466
Instead, it could either:
Do you have a preference, @mxre?
CC @Coder206
The text was updated successfully, but these errors were encountered: