Skip to content

fix: make demo container building optional via cmake option#188

Merged
casaroli merged 1 commit intoproject-ocre:mainfrom
gounthar:fix/optional-demo-containers
Mar 12, 2026
Merged

fix: make demo container building optional via cmake option#188
casaroli merged 1 commit intoproject-ocre:mainfrom
gounthar:fix/optional-demo-containers

Conversation

@gounthar
Copy link
Copy Markdown
Contributor

@gounthar gounthar commented Mar 11, 2026

Summary

Add OCRE_BUILD_DEMO_CONTAINERS cmake option (default ON) to control whether demo_containers.cmake is included during the build. This allows building the Ocre runtime on host platforms where WASI SDK is not available.

Motivation

WASI SDK ships pre-built binaries for six host platforms (x86_64 and arm64 on Linux, macOS, Windows) but not for riscv64. When building the Ocre runtime on RISC-V hardware, the demo container compilation fails because it depends on WASI SDK through the ocre-sdk submodule.

The runtime itself (ocre_mini, ocre_demo, ocre_cmd) compiles and runs correctly on riscv64 without this dependency. I verified this on a Banana Pi F3 (SpacemiT K1, rv64gc, 16 GB RAM, Debian Trixie). All three binaries build clean and successfully run .wasm containers.

Usage

# Default behavior (unchanged)
cmake ..
make -j$(nproc)

# Skip demo container building (for platforms without WASI SDK)
cmake .. -DOCRE_BUILD_DEMO_CONTAINERS=OFF
make -j$(nproc)

Context

Blog post documenting the full RISC-V build and testing: Can WebAssembly Run on RISC-V?

Test plan

  • Default build (-DOCRE_BUILD_DEMO_CONTAINERS=ON) behaves identically to current main
  • Build with -DOCRE_BUILD_DEMO_CONTAINERS=OFF skips demo container compilation
  • All three binaries (ocre_mini, ocre_demo, ocre_cmd) build successfully with the option OFF

@gounthar gounthar requested review from kr-t and srberard as code owners March 11, 2026 21:27
Add OCRE_BUILD_DEMO_CONTAINERS option (default ON) to control whether
demo_containers.cmake is included. This allows building the Ocre runtime
on platforms where WASI SDK is not available (e.g. riscv64), by passing
-DOCRE_BUILD_DEMO_CONTAINERS=OFF.

The demo containers require the ocre-sdk submodule which uses WASI SDK
to compile C to WebAssembly. WASI SDK ships pre-built binaries for
x86_64 and arm64 only, so the demo build fails on other architectures.

The runtime itself (ocre_mini, ocre_demo, ocre_cmd) builds and runs
correctly on riscv64 without this dependency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
@gounthar gounthar force-pushed the fix/optional-demo-containers branch from 226ed93 to 58cec7d Compare March 11, 2026 21:29
@casaroli casaroli merged commit f6cbccf into project-ocre:main Mar 12, 2026
34 checks passed
@gounthar gounthar deleted the fix/optional-demo-containers branch March 12, 2026 10:12
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.

2 participants