-
-
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
Can't statically link on Windows when building for debug #109
Comments
Interesting, thanks for reporting the issue! The idea is that this crate builds the C++ library SPIRV-Cross as part if it's build. In order to do this it uses cc-rs in spirv_cross's build.rs. I believe the default behavior when static linking on Windows would mean that Could static linking be avoided in this case? (You should be able to use Rust and C++ together fine without static linking, but maybe you're considering distribution of the executable or something else) Was the C++ executable built with |
The original project that ran into this is meant to be a dll instead of an executable, and distributed by itself. In the future I'd like the the dll to be entirely Rust, but until then it has some C++ portions. For the time being I need to statically link the two together. By default, Debug mode will compile using I might try to play with the build.rs to build with Thank you so much for the quick reply! I can't believe I didn't think about the runtime library flags... |
Hmmm... after some quick experimenting it's not as simple as compiling SPIRV-Cross with Thanks for your help! Feel free to close this issue if you don't think it's necessary. |
Rust currently always uses the release CRT. It does not have the option to use the debug CRT. Every crate that builds C code therefore builds it with the release CRT and so trying to link the resulting staticlib into a C project using the debug CRT will cause a CRT mismatch. |
Ah, that's good to know! In that case I'll close the issue. Thanks, @retep998! |
Hello, I'm trying to put together an application that uses both C++ and rust. What I've done is create a static lib in rust that I then link into a C++ executable.
The problem I'm running into is that appears that spirv-cross is being built for Release on Windows no matter what. I've put together a small repro with build instructions here if you're interested.
This only reproduces when building in Debug mode on Windows. In Release mode it seems to work fine, and other platforms (Linux and macOS) seem to be fine in either Debug or Release modes.
Here's the linker error that I run into:
I'm a bit new to using Rust in this way, but is there a way to configure the build? As you can see in the repro, I'm not consuming spirv-cross directly, but instead consuming it through wpgu.
I'd be willing to submit a PR if required. I just need to know what direction to look in/what to look for.
Thanks for your project!
The text was updated successfully, but these errors were encountered: