Enable exceptions and pthreads atomics for KiCad WASM build

Build fixes:
- Enable C++ exceptions in wxWidgets (--enable-exceptions, -fexceptions)
  Required for KiCad's OnExceptionInMainLoop override in debug builds
- Add -matomics -mbulk-memory to all dependency builds for shared memory
  Required for pthreads support with Emscripten
- Fix docker/build.sh output copy path (pcbnew/ not bin/)
- Make workspace mount read-only in docker-compose.yml

Updated dependency scripts:
- build-freetype.sh, build-harfbuzz.sh, build-protobuf.sh
- build-zstd.sh, build-opencascade.sh, build-boost.sh
- build-pixman.sh, build-cairo.sh (meson cross-file)
- build-wxuniversal-wasm.sh, build-pcbnew.sh

🤖 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-13 11:29:45 +01:00
commit d8d934ffca
13 changed files with 100 additions and 34 deletions

View file

@ -57,8 +57,8 @@ cd "${PROTOBUF_BUILD}"
emcmake cmake "${PROTOBUF_DIR}" \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} \
-DCMAKE_INSTALL_PREFIX="${SYSROOT}" \
-DCMAKE_C_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread" \
-DCMAKE_CXX_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread" \
-DCMAKE_C_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread -matomics -mbulk-memory" \
-DCMAKE_CXX_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread -matomics -mbulk-memory" \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_EXAMPLES=OFF \
-Dprotobuf_BUILD_PROTOC_BINARIES=OFF \
@ -68,5 +68,16 @@ emcmake cmake "${PROTOBUF_DIR}" \
emmake make -j${JOBS}
emmake make install
# Create symlinks without debug suffix for pkg-config compatibility
# Protobuf CMake adds 'd' suffix for Debug builds but pkg-config expects 'libprotobuf'
if [ -f "${SYSROOT}/lib/libprotobufd.a" ] && [ ! -f "${SYSROOT}/lib/libprotobuf.a" ]; then
ln -sf libprotobufd.a "${SYSROOT}/lib/libprotobuf.a"
log_info "Created libprotobuf.a symlink for pkg-config"
fi
if [ -f "${SYSROOT}/lib/libprotobuf-lited.a" ] && [ ! -f "${SYSROOT}/lib/libprotobuf-lite.a" ]; then
ln -sf libprotobuf-lited.a "${SYSROOT}/lib/libprotobuf-lite.a"
log_info "Created libprotobuf-lite.a symlink for pkg-config"
fi
create_stamp "${PROTOBUF_STAMP}"
log_info "Protobuf build complete!"