Use a C++ library built with MDd_DynamicDebug?

Hello, I'm trying to link my Swift program (Swift 6.0.1) with a C++ library (in my case, Luau) built in debug mode, so with MDd_DynamicDebug.

If I try to do so,I have the following error:

lld-link: error: /failifmismatch: mismatch detected for 'RuntimeLibrary':
>>> C:\Users\natinusala\AppData\Local\Programs\Swift\Platforms\6.0.1\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\x86_64\swiftrt.obj has value MD_DynamicRelease
>>> Luau.VM.lib(ldo.obj) has value MDd_DynamicDebug

If I rebuild Luau in release mode, it works. However this means that I can't really use a debugger on my program anymore when/if it crashes on the C++ side (which sometimes happen when manipulating the Lua stack).

I understand the reason behind this error however I feel like when my Swift package is compiled in debug mode, it should use a Swift standard library / runtime also in debug mode, shouldn't it?

Is there a way for me to use the library in debug mode? Like a debug version of swiftrt.obj anywhere that could be used instead of the release one when my own Swift code is compiled in debug mode? Maybe use a debug version of the toolchain?

I also had to add -D_ITERATOR_DEBUG_LEVEL=0 when building Luau because there was a mismatch there too (swiftrt.obj has 0, default Luau has 2).

1 Like