Skip to content

cvcpkg: wasmtime in the arix and ariglx recipes, linked by name (G1, ninth part) - #1148

Merged
transfix merged 2 commits into
masterfrom
feat/wasm-in-recipes
Nov 11, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/wasm-in-recipes

Conversation

@transfix

Copy link
Copy Markdown
Owner

G1, ninth part: the packaged arix and ariglx run a document's wasm: block (roadmap §8.3).

The problem

  • No wasmtime in the packages. The cvcpkg arix and ariglx packages were built without wasmtime. So a wasm: block ran only in a host someone built by hand.
  • A builder path in the binary. Adding wasmtime to the recipes alone would have shipped broken hosts.
    • Upstream's Linux libwasmtime.so has no SONAME, and the cvcpkg package's wasmtime::wasmtime is an UNKNOWN imported target. So CMake links it by its path, and the host records that path as the library it needs: ../wt/lib/libwasmtime.so, relative to the build tree.
    • An installed host can't load it. Even the build tree's copy loads only when started from its own build directory. The in-tree ctests pass only because they run from there.

The fix

The recipes (cvcpkg/recipes/arix, cvcpkg/recipes/ariglx):

  • wasmtime is a build dep and a runtime dep, so cvcpkg install arix brings it into the same prefix.
  • build.sh configures with -DARI_WITH_WASM=ON / -DARIGL_WITH_WASM=ON, so a build that can't find wasmtime fails instead of packaging a host without guests.
  • Each description says what a wasm: block does.

The publish workflow (publish-cvcpkg.yml), in the arix and ariglx steps:

  • It installs wasmtime into a prefix of its own and adds it to CVC_DEPS_PREFIX and LD_LIBRARY_PATH.
  • Before packing, each host runs src/ariadne_wasm/tests/wasm_block.ari:
    • arix test, which must report ok … (6 tests;
    • ariglx check, whose requires: [wasm], ari_init and init: call into the guest must load.

Linked by name (src/ariadne_wasm/ariadne_wasm.cmake). On Linux, cvc_ariadne_wasm_host links a .so wasmtime through its own SHARED IMPORTED GLOBAL target with IMPORTED_NO_SONAME. CMake then links it as -lwasmtime, and the host needs plain libwasmtime.so, found in ../lib beside libcvc. Windows and macOS are unchanged.

Docs

  • ARIADNE.md §9.6: the packages carry the guests.
  • The roadmap:
    • a "G1's ninth part, built" bullet in §8.3;
    • the item taken off "Left for G1";
    • the G1 row.

Tests

  • The link, in WSL (Ubuntu 22.04, cvcpkg's Linux wasmtime 45.0.0+cvc.1). A small program linked through this tree's real ariadne_wasm.cmake:

    Needs From the build tree Installed as bin/ + lib/, build prefix gone
    Before ../wt/lib/libwasmtime.so fails fails
    After libwasmtime.so engine ok engine ok
  • Windows static tree: arix (with wasm) reconfigured and rebuilt; arix_wasm_block, ari_wasm_needs_arix and ariadne_wasm_test pass.

  • cvcpkg validate passes for arix. For ariglx it reports only imgui-w32, which the cvcpkg installed on this box doesn't know (cvcGL: Dear ImGui from the imgui-w32 package (a 32-bit ImWchar), imgui as the fallback #1072's dep); wasmtime resolves.

  • Not run: the publish workflow's new steps, which run at a release, or in a dry-run dispatch if you want one first. This PR's package-linux job builds arix in-tree against shared wasmtime on Linux and runs the wasm tests with the new link.

Left for G1

  • A host option for state_exec.policy, and pure exports on the read lane.

…ninth part)

The packaged scripting hosts were built without wasmtime, so a document's
wasm: block ran only in a host someone built by hand.

Both recipes now name wasmtime as a build and runtime dep and configure
with -DARI_WITH_WASM=ON / -DARIGL_WITH_WASM=ON, so a build that can't
find it fails instead of packaging a host without guests.
publish-cvcpkg.yml installs wasmtime for their steps, and each host runs
src/ariadne_wasm/tests/wasm_block.ari before it packs: arix test, and
ariglx check.

Linked by name. Upstream's Linux libwasmtime.so has no SONAME, and the
cvcpkg package's target is UNKNOWN, so CMake linked it by its path, and
the host recorded that path, relative to its build tree, as the library
it needs: an installed arix could not have loaded it, and even the
build tree's only from its own directory. cvc_ariadne_wasm_host now
links it through a SHARED imported target with IMPORTED_NO_SONAME, so
the host needs plain libwasmtime.so, found in ../lib beside libcvc.
@transfix
transfix enabled auto-merge (squash) November 11, 2026 20:28
@transfix
transfix merged commit 75ab054 into master Nov 11, 2026
25 of 33 checks passed
@transfix
transfix deleted the feat/wasm-in-recipes branch November 11, 2026 22:40
transfix added a commit that referenced this pull request Nov 12, 2026
Only job_intrinsics_test.cpp conflicted. Master's #1150 fixed the same
pre-#1137 calls this branch fixed in 600c144, but kept a ProviderGuard that
clears the app's providers on the way out; this takes master's version, so the
file matches master.

The rest merged cleanly: #1151's spawn points (world_spawns.cpp, the world
rules' spawns, the loader and scene-world tests), #1145's macOS libcurl with
WebSockets (CMake and a ci.yml configure assertion), #1148's wasmtime in the
arix and ariglx recipes, and #1149's ocean band. None of them registers an
action-intrinsic provider, and none adds writable process-wide state: their
only new statics are vehicle_view.cpp's constant colour tables.
transfix added a commit to cy-pca/cvcpkg that referenced this pull request Nov 13, 2026
Upstream's Linux libwasmtime.so (wasmtime 45.0.0 C API) has no DT_SONAME,
and cvc.1's wasmtimeConfig.cmake made wasmtime::wasmtime an UNKNOWN imported
target, so every consumer recorded the path it linked the library from as
DT_NEEDED (../wt/lib/libwasmtime.so in transfix/libcvc#1148) and failed to
load once installed.

- build.sh sets the SONAME libwasmtime.so with cvcpkg's patchelf.
- The generated config follows the bundle's link variant: SHARED IMPORTED
  with IMPORTED_SONAME in a shared bundle, STATIC IMPORTED over
  libwasmtime.a in a static one (cvc.1's static bundles handed out the .so).
- test.sh + smoke/: checks the library's own name, builds a
  find_package(wasmtime) consumer, checks what it records, and runs it from
  a bin/ + lib/ copy.
- bin/wasmtime is declared for linux and macos only: build.ps1 never staged
  the CLI, and strict package.files refused the Windows pack.
- depends.runtime: [] keeps the new build tools (patchelf, cmake, ninja) out
  of the bundles' required deps.

The macOS dylibs already name themselves @rpath/libwasmtime.dylib and are
unchanged.
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.

1 participant