Skip to content

Use /MDd flag to compile in debug mode if cargo is in debug mode#167

Open
itsjunetime wants to merge 1 commit into
purpleprotocol:masterfrom
itsjunetime:fix_mimalloc_windows_linker
Open

Use /MDd flag to compile in debug mode if cargo is in debug mode#167
itsjunetime wants to merge 1 commit into
purpleprotocol:masterfrom
itsjunetime:fix_mimalloc_windows_linker

Conversation

@itsjunetime

Copy link
Copy Markdown

If mimalloc_rust is 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_rust was always building mimalloc_rust in DynamicRelease mode, which would conflict with other libraries building against msvc who were correctly respecting the debug level (and building in DynamicDebug mode).

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_supported didn't do the trick - I guess the build system isn't aware that /MDd is a valid flag.

@nathaniel-daniel

nathaniel-daniel commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

I think this is an issue with the mupdf/msbuild crate? Rust doesn't support the non-debug runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants