Use /MDd flag to compile in debug mode if cargo is in debug mode#167
Use /MDd flag to compile in debug mode if cargo is in debug mode#167itsjunetime wants to merge 1 commit into
Conversation
|
I think this is an issue with the |
|
Hmm, I'm not sure that I agree. Looking at this comment and comparing it to the linking that mupdf requests, I think that mupdf is handling this better. They specifically request to link with the debug runtime when it's in debug mode, and the release runtime when in release mode. That just conflicts with rust's default behavior, which makes it work weirdly when combined with libraries (like mimalloc) which use rust's default behavior. So I think the best course of action is actually to add this Does everything I'm saying here line up with your understanding? I feel a bit out of my depth since I don't interact with windows much. |
|
The main issue is that you can't really coordinate this change with everything else. I'd argue this belongs in Also, an msrv of 1.79 would probably require a few crates to bump msrv for this. This is kind of an annoying/complicated issue. |
If
mimalloc_rustis used in conjunction with another msvc library, it needs to set the correct run-time library version (as specified by this microsoft doc). Previously,mimalloc_rustwas always building mimalloc_rust inDynamicReleasemode, which would conflict with other libraries building against msvc who were correctly respecting the debug level (and building inDynamicDebugmode).This issue can be seen in the CI runs of this PR, where mupdf-rs was correctly building in debug mode when cargo was building in debug mode, but the mimalloc DLL was building in release mode still. The linker refused to link the libraries together because of the differing runtime library mode.
As you can see from the later commits on the aforementioned PR, this change fixes the issue. For some reason, using
build.flag_if_supporteddidn't do the trick - I guess the build system isn't aware that/MDdis a valid flag.