Conversation
Refactored the Emscripten build system to properly separate compiler flags (used during .c -> .o compilation) from linker flags (used during .o -> .js linking). This eliminates hundreds of "linker setting ignored during compilation" warnings. Changes: - Split CFLAGS_WASM into CFLAGS_COMPILE and LDFLAGS_WASM in templates/Variant.mk - Split flag constants in scripts/prepareVariants.ts into *CompileFlags and *LinkFlags variants - Fixed malformed `-s -lccall.js` flag to `-lccall.js` - Moved MIN_NODE_VERSION and NODEJS_CATCH_EXIT to node-specific targets only - Added scripts/validate-emcc-flags.ts for testing flag classification Compiler flags (CFLAGS_COMPILE): optimization (-Oz, -O0, -flto), defines (-DQTS_DEBUG_MODE, etc.), debug info (-gsource-map), sanitizers (-fsanitize) Linker flags (LDFLAGS_WASM): -s settings (MODULARIZE, ENVIRONMENT, etc.), --closure, --pre-js, library flags (-lccall.js, -lasync.js) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add -Wno-js-compiler to suppress HEAPU8/HEAP8 warnings (these exports are needed but marked "invalid" by emscripten) - Only add -gsource-map for debug builds with separate wasm files (source maps are incompatible with SINGLE_FILE mode) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
These functions (QTS_BuildIsSanitizeLeak, QTS_BuildIsDebug, QTS_TestStringArg) are so simple they get inlined/eliminated by LTO, causing Asyncify warnings about non-existing functions. Since they can't call async code anyway, there's no need to include them in the removelist. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove HEAP8 and other unused HEAP types from emscripten exports - Update context.ts to use HEAPU8.buffer instead of HEAP8.buffer - Remove unused heap type definitions from emscripten-types.ts - Add QTS_RecoverableLeakCheck and QTS_GetDebugLogEnabled to asyncify exclusion list Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CFLAGS_COMPILE) from linker flags (LDFLAGS_WASM) to eliminate ~160+ warnings about linker settings being ignored during compilation-s -lccall.jsflag (changed to-lccall.js)MIN_NODE_VERSIONto node-specific targets only-Wno-js-compilerto suppress HEAPU8 export warnings-gsource-mapfor debug builds with separate wasm files (incompatible with SINGLE_FILE)Test plan
🤖 Generated with Claude Code