purpleprotocol / mimalloc_rust

A Rust wrapper over Microsoft's MiMalloc memory allocator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Debug build fails on Windows

Boscop opened this issue · comments

= note: LINK : fatal error LNK1181: cannot open input file 'mimalloc-static.lib'

But the file exists in target\debug\build\libmimalloc-sys-e3452f81d9314272\out\build\RelWithDebInfo\mimalloc-static.lib.
It's using the wrong profile: I'm building in debug, but it's using RelWithDebInfo.

According to WindowsBunny:

The build script simplifies down the four cmake targets to a boolean is_debug https://github.com/purpleprotocol/mimalloc_rust/blob/master/libmimalloc-sys/build.rs#L83-L89
So later when it finds the path to where the resulting library is, it makes invalid assumptions https://github.com/purpleprotocol/mimalloc_rust/blob/master/libmimalloc-sys/build.rs#L107-L119
I'm actually not sure why it even pushes out_dir onto dst.
All the examples of using the cmake crate show passing dst directly to cargo without any modification.
It shouldn't get out_dir based on is_debug.
Instead it should just check get_cmake_build_type() directly and do it based on that (which is robust in case in the future rust ever gains the option to enable linking against the debug CRT and the cmake crate gains support for that).


Related: #10

@Boscop Thank you for opening this and providing a detailed description. There seems to be many windows issues at this point. I can attempt to fix this but I have no way to test it (I don't have access to a windows machine and even the windows CI seems to fail because of missing headers).

@octavonce You can tag me for windows build issues.