Comments (5)
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 /MDd
. Overriding that by compiling with /MD
does resolve the linker issues, but this does put me halfway to building as Release. I also tried /MT
for fun and got more linker errors than before.
I might try to play with the build.rs to build with /MDd
(or possibly building as debug, I guess building as release with /MDd
is just as arbitrary). How does this usually work in the Rust ecosystem? Is there a way to inform indirect dependencies of desired build configurations? I've only ever seen people read environment variables from their build.rs, but I also haven't seen too many of them.
Thank you so much for the quick reply! I can't believe I didn't think about the runtime library flags...
from spirv_cross.
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.
from spirv_cross.
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 /MT
would be provided while building SPIRV-Cross, which statically links a particular version of the runtime library.
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 /MT
? I would try changing it on that side first if possible and seeing if it helps. Otherwise we can try adjusting the build.rs to pass different flags for the SPIRV-Cross (C++) portion while still building the spirv_cross (Rust) portion as a static library.
from spirv_cross.
Hmmm... after some quick experimenting it's not as simple as compiling SPIRV-Cross with /MDd
. Unfortunately, I've had my fill of linker errors for the past couple of days and will probably just put up with building my dll with /MD
for now. I may come back to this later.
Thanks for your help! Feel free to close this issue if you don't think it's necessary.
from spirv_cross.
Ah, that's good to know! In that case I'll close the issue.
Thanks, @retep998!
from spirv_cross.
Related Issues (20)
- Running examples from `master` fails HOT 1
- Release updated version to crates.io HOT 2
- Texture data, arrayed/depth? HOT 5
- Remove `cdylib` in crate-type section? HOT 2
- Wasm32 Example HOT 4
- Cross-compiled windows binary won't work because of missing libstdc++-6.dll HOT 3
- Expose SamplerAddress::MirrorClampToEdge HOT 2
- stage_inputs format HOT 4
- Rerun spirv_cross/wasm and commit changes
- Broken docs.rs builds on Windows HOT 1
- Expose `{get,set}_common_options`
- Make compiler options non-exhaustive HOT 2
- Implement sc_internal_compiler_set_entry_point for WASM HOT 1
- Add GLSL ES 3.10 and 3.20 versions
- Support for wasm32-wasi HOT 1
- Support msl::Version::V2_3
- Update to more recent upstream? HOT 2
- Migrate to GitHub Actions
- Unable to build on MacOS HOT 1
- Support for ray tracing shaders
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spirv_cross.