| Filename | Latest commit message | Latest commit date |
|---|---|---|
Replace the legacy Emscripten JS-exceptions model with native wasm-EH (legacy encoding) across the whole build, keeping Asyncify coroutines working via a from-source Binaryen --hoist-cpp-catches pre-pass. Net result: native-EH is the only build mode, the 3D viewer is on by default, and pcbnew shrinks substantially. Highlights: - Binaryen submodule everywhere + --hoist-cpp-catches integration in apply-asyncify; post-link Asyncify covers every app wasm (not just standalone test wasm). - Build deps (incl. OpenCASCADE without OCC_CONVERT_SIGNALS) and all KiCad apps with -fwasm-exceptions; emscripten_sleep added to the post-link asyncify-imports. - libcontext fiber entry wired under native exceptions; while-loop main loop + currData shim injected into all wx apps. - Native-EH collab apply fixed: DEBUG-define the embind TU + match all out-of-CMake C++ TUs' ABI flags to the core, fixing the vtable-layout skew / mis-dispatch. - 3D viewer enabled by default (real raytracer linked, not the stub). - Retire the EH-spike scaffolding; flip the asyncify-races ablation pins to shim-redundancy pins (native-EH stays clean with the legacy shims ablated). - Fix the asyncify-races quiescence check to not require Asyncify.currData==0: under the native-EH per-frame-yield top loop the main stack is asyncify-suspended every frame, so currData legitimately churns (a freed-but-not-yet-nulled buffer, not a leak). Refresh the pcbnew toolbar screenshot baseline for the new kicad. - CI: drop the obsolete binaryen_version input/env (the build uses the binaryen submodule fork's wasm-opt, not a version download); key the wasm-output cache on the binaryen submodule SHA instead. Bumps the wxwidgets + binaryen submodules to their squashed feature commits. Validated green: all 7 apps native-EH (real 3D in pcbnew); KiCad e2e 63/63 Firefox + Chromium (3D viewer renders); wx 336; coroutine 34/34 both engines; asyncify 7/7 both engines. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
| .. | ||
| build.sh | ||
| docker-compose.yml | ||
| Dockerfile | ||
| entrypoint.sh | ||
| README.md | ||
| shell.sh | ||
Docker Build Environment for KiCad WASM
This directory contains Docker configuration for building KiCad for WebAssembly in a reproducible, isolated environment.
Prerequisites
- Docker Desktop (with Docker Compose v2)
- Git submodules initialized:
git submodule update --init --recursive
Quick Start
# Build KiCad WASM (full build)
./docker/build.sh
# Build with options
./docker/build.sh --no-clean # Skip cleaning build directory
./docker/build.sh --debug # Build with debug symbols
# Interactive shell for debugging
./docker/shell.sh
Branch-Specific Builds
Each git branch gets isolated Docker containers and volumes, enabling parallel development:
# On branch 'main' → containers/volumes prefixed with 'kicad-wasm-main'
# On branch 'feature-x' → containers/volumes prefixed with 'kicad-wasm-feature-x'
This allows you to:
- Work on multiple branches simultaneously using git worktrees
- Each worktree has its own build cache (no conflicts)
- Switch branches without rebuilding from scratch
Using git worktrees for parallel development:
# Create a worktree for a new branch
git worktree add ../kicad-wasm-feature path/to/branch
# Build in the worktree (uses isolated Docker volumes)
cd ../kicad-wasm-feature
./docker/build.sh
# List all worktrees
git worktree list
What Gets Built
The build process includes:
-
Dependencies (cached in Docker volume):
- GLM (header-only)
- Zstd, Protobuf
- FreeType, HarfBuzz
- Pixman, Cairo
- Boost (Locale)
- OpenCASCADE (optional, for 3D/STEP)
- CURL headers, libgit2 headers (stubs)
-
wxWidgets (built from submodule)
-
KiCad PCBnew (main application)
Container Resources
Configured for M4 Max (adjust in docker-compose.yml):
- CPUs: 10 cores
- Memory: 16GB
Volume Strategy
| Path | Type | Purpose |
|---|---|---|
/workspace |
Bind mount | Source code |
/workspace/build-wasm |
Named volume | Build cache (deps, sysroot) |
/workspace/output |
Bind mount | Final WASM output |
Common Commands
# Start container
docker compose -f docker/docker-compose.yml up -d
# Run a command inside
docker compose -f docker/docker-compose.yml exec kicad-wasm-builder <command>
# View logs
docker compose -f docker/docker-compose.yml logs -f
# Stop container
docker compose -f docker/docker-compose.yml down
# Clear build cache (full rebuild)
docker volume rm docker_kicad-build-cache
Troubleshooting
Build freezes
The OpenCASCADE build is very resource-intensive. If it freezes:
- Reduce parallel jobs: Edit script to use
-j4instead of-j$(nproc) - Monitor with
docker stats - Consider building OpenCASCADE separately with
./scripts/deps/build-opencascade.sh
Permission issues
Files created in container are owned by root. To fix:
sudo chown -R $(whoami) output/
Cache issues
# Clear all cached builds
docker volume rm docker_kicad-build-cache
# Or clear specific stamps inside container
./docker/shell.sh
rm /workspace/build-wasm/stamps/*.stamp