purpleprotocol / mimalloc_rust

A Rust wrapper over Microsoft's MiMalloc memory allocator
MIT License
503 stars 41 forks source link

Release Build with debug-assertions=true Cause Linking Failure #9

Closed cwfitzgerald closed 4 years ago

cwfitzgerald commented 4 years ago

If I build a dependent crate with the release build with debug-assertions=true it causes it to try to link with -lmimalloc_debug which isn't found.

In attempting to provide a easy repro, I may have nuked my home directory, so more information coming later.

octavonce commented 4 years ago

@cwfitzgerald This is because mimalloc's CMakeLists.txt produces a different library name on debug mode. We use cfg!(debug_assertions) to check which library to link. There is unfortunately no way to determine if we are doing a rust debug build without cfg!(debug_assertions)

cwfitzgerald commented 4 years ago

If the cmake crate thinks it's in debug mode and builds a debug library and mimalloc-sys thinks it's in debug mode, wouldn't it be reasonable to expect linking to still pass, just to get a debug version of the library? Let me get you some more information, got preoccupied after I blew my computer up.

octavonce commented 4 years ago

@cwfitzgerald This issue should have been fixed in the latest release. Let me know if it works for you

cwfitzgerald commented 4 years ago

Works like a charm! Thank you!