Skip to content

Build the native wrappers with the CRT tslang links against - #7

Open
ASDAlexander77 wants to merge 1 commit into
mainfrom
debug-crt-for-native-wrappers
Open

ASDAlexander77 wants to merge 1 commit into
mainfrom
debug-crt-for-native-wrappers

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Problem

scripts/build_core.bat compiled io, datetime, regex, thread and http.cpp without a runtime library flag, so cl fell back to its default /MT (static release CRT) in the debug build too.

A debug tslang program (--di, no --opt) links lib\debug\<model>\TypeScriptDefaultLib.lib together with the static debug CRT (libcmtd, _ITERATOR_DEBUG_LEVEL=2, see tslang/tslang/exe.cpp). Linking an exe against the debug archive therefore failed:

LLVMSupport.lib(...) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in TypeScriptDefaultLib.lib(datetime.obj)
LLVMSupport.lib(...) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in TypeScriptDefaultLib.lib(datetime.obj)

This is what fails test-compile-gc-defaultlib-collector in a debug TypeScriptCompiler build. CI builds Release only, so it never showed up there.

Fix

  • Debug: DBG_CL=/MTd /Z7 /std:c++latest
  • Release: DBG_CL=/MT /std:c++latest (explicit; same as the previous default)

Tested

Rebuilt scripts\build_vs.bat debug gc and ran TypeScriptCompiler's debug test-compile-gc-defaultlib-collector, test-jit-gc-defaultlib-collector and test-compile-gc-shared-auto against it (DEFAULT_LIB_PATH pointed at the rebuilt __build): all pass. The other two also need a TypeScriptCompiler fix for a CRT report hook breakpoint at exit, which comes in a separate PR there. Only the debug gc model was rebuilt here; rc/none use the same flags.

🤖 Generated with Claude Code

build_core.bat compiled io/datetime/regex/thread/http.cpp without a runtime
library flag, so cl used its default /MT (static release CRT) for the debug
build as well. A debug tslang program (--di, no --opt) links the debug archive
together with the static debug CRT (libcmtd, _ITERATOR_DEBUG_LEVEL=2), so
`tslang --emit=exe` against lib\debug\<model>\TypeScriptDefaultLib.lib failed
with LNK2038 RuntimeLibrary / _ITERATOR_DEBUG_LEVEL mismatches in
TypeScriptDefaultLib.lib(datetime.obj). This is what failed
test-compile-gc-defaultlib-collector in a debug TypeScriptCompiler build.

Debug now passes /MTd; release passes /MT explicitly (unchanged behaviour).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant