Fix KiCad WASM build and runtime errors

Build improvements:
- Change -O0 to -O1 to fix "local count too large" asyncify error
- Add wasm-emscripten-finalize to host (Docker OOMs on large WASM)
- Use -gseparate-dwarf for smaller main binary with debug info
- Build native protoc for code generation
- Add more functions to asyncify removelist

Runtime fixes:
- Add inject-dyncall-shims.sh to fix "dynCall_* is not defined" in Emscripten 4.x
- Update wxwidgets with browserInfo.name fix

New stubs and bindings:
- Add Embind bindings for JavaScript interop
- Add stubs for scripting, API plugin, PCB frame, navlib

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2025-12-22 16:30:53 +01:00
commit 9c271996c2
17 changed files with 699 additions and 13 deletions

View file

@ -49,8 +49,37 @@ if [ ! -d "${PROTOBUF_DIR}" ]; then
rm "protobuf-${PROTOBUF_VERSION}.tar.gz"
fi
log_info "Building Protobuf ${PROTOBUF_VERSION} for WASM..."
log_info "Building Protobuf ${PROTOBUF_VERSION}..."
# Step 1: Build native protoc for the host (needed for code generation)
# This is required because the system protoc may be a different version
PROTOBUF_HOST_BUILD="${BUILD_ROOT}/deps/protobuf-host"
PROTOC_NATIVE="${PROTOBUF_HOST_BUILD}/protoc"
if [ ! -f "${PROTOC_NATIVE}" ]; then
log_info "Building native protoc for host..."
mkdir -p "${PROTOBUF_HOST_BUILD}"
cd "${PROTOBUF_HOST_BUILD}"
# Build native (not cross-compiled) protoc
cmake "${PROTOBUF_DIR}" \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_EXAMPLES=OFF \
-Dprotobuf_BUILD_SHARED_LIBS=OFF \
-Dprotobuf_WITH_ZLIB=OFF
make -j${JOBS} protoc
log_info "Native protoc built: ${PROTOC_NATIVE}"
fi
# Install native protoc to sysroot/bin for CMake to find
mkdir -p "${SYSROOT}/bin"
cp "${PROTOC_NATIVE}" "${SYSROOT}/bin/protoc"
log_info "Native protoc installed to ${SYSROOT}/bin/protoc"
# Step 2: Build WASM library
log_info "Building Protobuf library for WASM..."
mkdir -p "${PROTOBUF_BUILD}"
cd "${PROTOBUF_BUILD}"