WASM module wallet-core does not seem to work with Windows as a build target, as observed in the wallet-cli integration attempt found here.
When the Windows linker tries to link the FFI no_manglemalloc function, a symbol collision happens due to the Windows ucrt.lib also exposing a malloc function. The Microsoft MSVC linker detects the collision and stops the linking process.
Expected behaviour
wallet-core would ideally also work on Windows. A mitigation for this problem would be to either rename malloc or provide an alias for Windows targets. Dynamic dispatching would also be an option.
error: linking with `link.exe` failed: exit code: 1169
= note: ucrt.lib(api-ms-win-crt-heap-l1-1-0.dll) : error LNK2005: malloc already defined in libdusk_wallet_core-7869f1f67ccd1991.rlib(dusk_wallet_core-7869f1f67ccd1991.dusk_wallet_core.6f4f5e864c2476fd-cgu.6.rcgu.o)
D:\a\wallet-cli\wallet-cli\target\debug\deps\dusk_wallet-3f35c37386e26e19.exe : fatal error LNK1169: one or more multiply defined symbols found
error: could not compile `dusk-wallet` (lib test) due to previous error
warning: build failed, waiting for other jobs to finish...
error: linking with `link.exe` failed: exit code: 1169
Describe the bug
WASM module
wallet-core
does not seem to work with Windows as a build target, as observed in thewallet-cli
integration attempt found here.When the Windows linker tries to link the FFI
no_mangle
malloc
function, a symbol collision happens due to the Windowsucrt.lib
also exposing amalloc
function. The Microsoft MSVC linker detects the collision and stops the linking process.Expected behaviour
wallet-core
would ideally also work on Windows. A mitigation for this problem would be to either renamemalloc
or provide an alias for Windows targets. Dynamic dispatching would also be an option.Logs/Screenshot
CI error: