Repository navigation
Conversation
libcvc builds as a static library for platform wasi, a WASI command for an engine such as Wasmtime, against cvcpkg's wasi column (cy-pca/cvcpkg#646). publish-cvcgl-wasm.yml's new libcvc-wasi job builds it on each v* tag with cvcpkg's wasi-sdk, runs state_exec_wasm_smoke and image_magick_roundtrip_test under wasmtime, and packs + publishes libcvc for wasi/wasm32. wasip1 has no threads (the thread API is there, std::thread throws), no sockets of its own, no processes, no signals and no terminal control: the model of Emscripten without -pthread, so the port reuses that build's switches. - CMake: an `elseif(WASI)` beside `if(EMSCRIPTEN)` builds with wasm exceptions in the standard encoding (-fwasm-exceptions, -wasm-enable-sjlj, -wasm-use-legacy-eh=false: the flavour of the whole wasi column) and an 8 MiB stack. The cvc target hands those flags, wasi-sdk's eh runtime (unwind, setjmp) and the static ImageMagick's wasi-libc emulations (signal, getpid, process clocks) to its consumers. Boost static, as on Emscripten. state_transport_ipc.cpp is left out, as on Windows. - inc/cvc/core/thread_support.h: CVC_NO_THREADS, for Emscripten without pthreads and for wasip1. The guards that only meant "no thread can start" use it (async_lane, lock_manager, sliced_task, media, data, world_worker, scene_swarm, field_step); those that also pick a browser API stay __EMSCRIPTEN__. producer_thread gets a wasi branch: the host's run_now() ticks it, since there is no Emscripten timer. - __wasi__ beside __EMSCRIPTEN__: stub out the Boost.Asio users (utility, loopback redirect, net_engine, local address) and cvc::process; browser.cpp has no process to spawn; host_signals has no signals (a stop comes from request_stop()); host_info gets isatty and no size; term_graphics probes nothing; uri drops dladdr and writes temp files under a random name instead of mkstemps; coef_mlp drops dladdr; private_file skips owner and mode checks; oidc takes randomness from getentropy; print takes no stdout lock; native_stack bounds the stack at wasm-ld's __stack_low. Checked in WSL with cvcpkg's wasi-sdk 33 and wasmtime 45, against wasi bundles built from #646: the cvc target and both smokes build without the cvcpkg env flags (the CMake branch alone), state_exec_wasm_smoke prints STATE_EXEC_WASM_OK, image_magick_roundtrip_test round-trips TIFF (byte-identical) and WebP through a preopened /tmp, and `cvcpkg pack --from-prefix --platform wasi` packs the install (relocatable CMake files).
This was referenced Nov 27, 2026
Merged
publish-cvcgl-wasm: ariglx-web for wasm and wasm-mt; libcvc and cvcgl for single-threaded wasm
#1555
Merged
# Conflicts: # src/cvc/ariadne/media.cpp
This branch has not been deployed
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.
libcvc builds for platform wasi: wasm32-wasip1, a WASI command for an engine such as Wasmtime.
publish-cvcgl-wasm.ymlgets alibcvc-wasijob that builds it on each v* tag, runs two smokes under wasmtime and publisheslibcvcfor wasi/wasm32. It's part of Joe's fleet ask of 2026-11-26 (wasm, wasm-mt and wasi builds on every release).Depends on cy-pca/cvcpkg#646, which fixes the wasi lanes of libcvc's closure (boost, pegtl, ImageMagick and its codecs). Until those bundles are published, the job's
install-depsstep fails.The target
WASI preview 1 has no threads (std::thread throws "Not supported", though mutexes and condition variables work), no sockets of its own, no processes, no signals and no terminal control. That matches Emscripten without
-pthread, so the port mostly reuses the switches that build already has:elseif(WASI)next toif(EMSCRIPTEN): wasm exceptions in the standard encoding (-fwasm-exceptions -mllvm -wasm-enable-sjlj -mllvm -wasm-use-legacy-eh=false, the flavour of the whole cvcpkg wasi column) and an 8 MiB stack.cvctarget passes the exception flags and wasi-sdk's eh runtime (unwind,setjmp) to every consumer, plus wasi-libc's signal, getpid and process-clock emulations, which the static ImageMagick links.state_transport_ipc.cpp(Unix domain sockets) is left out, as on Windows.CVC_NO_THREADS(newinc/cvc/core/thread_support.h): defined for Emscripten without pthreads and for wasip1. The no-threads guards that only meant "no thread can start" now use it: async_lane, lock_manager, sliced_task, media, data, world_worker, scene_swarm and field_step. Guards that also pick a browser API stay__EMSCRIPTEN__.producer_thread: the browser build ticks from an Emscripten timer. On wasi, ticks happen only when the host callsrun_now().__wasi__:cvc::process;browser.cpp(no process to spawn), host_signals (no signals: a stop comes only fromrequest_stop()), host_info (isatty without a size), term_graphics (no probe), uri (nodladdr; a random-name temp file instead ofmkstemps), coef_mlp (nodladdr);getentropy), print's stdout lock, native_stack's stack bound (__stack_low, as Emscripten'semscripten_stack_get_end).Checked
Tested locally in WSL Ubuntu 22.04 with cvcpkg's wasi-sdk 33 and wasmtime 45, against wasi bundles built from cvcpkg#646.
cvctarget and both smokes build with no cvcpkg env flags, so the CMake WASI branch supplies everything.wasmtime run -W exceptions=y state_exec_wasm_smokeprintsSTATE_EXEC_WASM_OK. That covers the state_exec locks with no threads,app::lock_manager()single, and the pools at threads 0.image_magick_roundtrip_test, with a preopened/tmp, round-trips TIFF (byte-identical) and WebP. Emscripten's static coder-registration workaround isn't needed on wasi.cmake --installpluscvcpkg pack --from-prefix --platform wasipacks the install (59.6 MB). Its CMake files name no build path, andcvcTargets.cmakecarries the EH flags andunwind/setjmpto consumers.Before the job can publish
pack --from-prefix --platform wasitags the bundlex86_64, and the job stops with an error saying so.publish-cvcgl-wasmdispatch withdry_run=false.Not covered
arior hosts. Whether there should be one, and in what form, is a question for Joe.CVC_NO_THREADSis the same condition as before for it; ci.yml's ari-wasm job covers it.