Skip to content

Commit 7af063d

Browse files
authored
GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives (#116327)
* GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/preview2 primitives * Add the configure changes * Update `wasm_build.py`
1 parent 6cddc73 commit 7af063d

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV WASI_SDK_VERSION=20
66
ENV WASI_SDK_PATH=/opt/wasi-sdk
77

88
ENV WASMTIME_HOME=/opt/wasmtime
9-
ENV WASMTIME_VERSION=14.0.4
9+
ENV WASMTIME_VERSION=18.0.2
1010
ENV WASMTIME_CPU_ARCH=x86_64
1111

1212
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Get WASI builds to work under wasmtime 18 w/ WASI 0.2/preview2 primitives.

Tools/wasm/wasi.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,10 @@ def main():
283283
# The 8388608 value comes from `ulimit -s` under Linux
284284
# which equates to 8291 KiB.
285285
"--wasm max-wasm-stack=8388608 "
286-
# Enable thread support.
287-
"--wasm threads=y --wasi threads=y "
286+
# Use WASI 0.2 primitives.
287+
"--wasi preview2 "
288+
# Enable thread support; causes use of preview1.
289+
#"--wasm threads=y --wasi threads=y "
288290
# Map the checkout to / to load the stdlib from /Lib.
289291
"--dir {HOST_DIR}::{GUEST_DIR} "
290292
# Set PYTHONPATH to the sysconfig data.

Tools/wasm/wasm_build.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,10 @@ def _check_wasi() -> None:
329329
# workaround for https://github.com/python/cpython/issues/95952
330330
"HOSTRUNNER": (
331331
"wasmtime run "
332-
"--env PYTHONPATH=/{relbuilddir}/build/lib.wasi-wasm32-{version}:/Lib "
333-
"--mapdir /::{srcdir} --"
332+
"--wasm max-wasm-stack=8388608 "
333+
"--wasi preview2 "
334+
"--dir {srcdir}::/ "
335+
"--env PYTHONPATH=/{relbuilddir}/build/lib.wasi-wasm32-{version}:/Lib"
334336
),
335337
"PATH": [WASI_SDK_PATH / "bin", os.environ["PATH"]],
336338
},

configure

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ then
15371537
dnl TODO: support other WASI runtimes
15381538
dnl wasmtime starts the proces with "/" as CWD. For OOT builds add the
15391539
dnl directory containing _sysconfigdata to PYTHONPATH.
1540-
[WASI/*], [HOSTRUNNER='wasmtime run --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --mapdir /::$(srcdir) --'],
1540+
[WASI/*], [HOSTRUNNER='wasmtime run --wasm max-wasm-stack=8388608 --wasi preview2 --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/'],
15411541
[HOSTRUNNER='']
15421542
)
15431543
fi

0 commit comments

Comments
 (0)