Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ Jamroot is its build configuration, and `libs/<name>` is its repository.
configures, once per compiler and run of b2, and a GCC 15.2 stops the build
before it compiles anything, naming PR121643 and asking for GCC 15.3 or newer;
- Python 3.9 or newer;
- for WebAssembly: wasi-sdk 34 and wasmtime 50.0.1;
- for WebAssembly: wasi-sdk 34, with the release's platform-independent
sysroot and builtins (`bash tools/ci/actions/wasi-sdk/install.sh` installs
it so in `.local/wasi-sdk`), and wasmtime 50.0.1;
- for WebAssembly components, such as wasi's: wit-bindgen 0.62.0, which
generates a world's C bindings, and the `wasi:http` WIT of WASI 0.2.12 and
0.3.0, the `wit/deps` directories of the Rust crates `wasip2` 1.0.4 and
Expand Down Expand Up @@ -1777,7 +1779,15 @@ wrapper each quoted as one word of Jam.
action before it is cached. It refuses an empty or relative prefix: b2 given
an empty `--prefix` installs into `/usr/local`. `install.sh source <dir>`
fills such a tree alone, for a machine whose Boost comes from elsewhere.
- `wasi-sdk` installs wasi-sdk 34 into `.local/wasi-sdk`, `wasmtime`
- `wasi-sdk` installs wasi-sdk 34 into `.local/wasi-sdk`: the runner's
build of its clang and tools, with the release's platform-independent
`wasi-sysroot-34.0` and `libclang_rt-34.0` in place of that build's
sysroot and compiler-rt builtins, each archive pinned by its SHA-256. A
per-host build's own sysroot carries `__FILE__` strings with the paths of
the machine that built it, so a WASI program would differ by host; with
the shared sysroot it is the same bytes on every host. Its `install.sh`
also installs wasi-sdk locally, from the superproject's root, for the
machine's own system and processor. `wasmtime`
installs wasmtime 50.0.1 on `PATH`, `mrdocs` installs MrDocs 2026.9.29 into
`.local/mrdocs`, and `node` sets up Node 26.7.0, with npm's cache keyed on
the lock files of `tools/doc`, `tools/lint`, every library's
Expand Down Expand Up @@ -1933,7 +1943,9 @@ The full lane set, `b2 -a`, fresh XML and missing-result checks remain mandatory
action defines a function of its own that `helpers.sh` holds), the Boost action's prefix
checks and the layouts it installs the headers and b2 in, and where the
wit-bindgen, WASI WIT and emsdk actions install what they download, what
they leave out, and their refusals: a runner no build of wit-bindgen or
they leave out, and their refusals; that the wasi-sdk action replaces the
runner's sysroot and builtins with the platform-independent ones, and fails
on a target those lack builtins for: a runner no build of wit-bindgen or
emsdk is pinned for, a crate that holds no WIT, an emsdk at another commit,
a release without its `node_modules`, an archive emsdk would download
unpinned, and an emcc that is not 6.0.11; the emsdk action's node wrapper,
Expand All @@ -1947,7 +1959,10 @@ corruption, interrupted transfers and atomic output. Their refusal tests cover b
and unsupported runners. Source-provider tests live in
`tools/openssl/build_test.py`, `tools/test/openssl_test.py` and
`tools/test/libdatachannel_test.py`: they cover source pins, staged content,
compiler variants and the single OpenSSL provider. They are separate from
compiler variants, the single OpenSSL provider, and OpenSSL's one fixed
prefix, `/webcpp-openssl`, which libcrypto keeps as its modules and engines
directories and `install_dev` stages under `DESTDIR`, so that the library is
the same bytes wherever it is built. They are separate from
runtime evidence and the full upstream OpenSSL suite.

**The site.** On every run of the superproject's CI, the job `site` runs
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ library on every target are published at <https://webcpporg.github.io/>.
- Python 3.9 or newer, which compares the examples with their expected output
and runs the tests of the build itself;
- for WebAssembly, wasi-sdk 34, whose clang builds for wasm32-wasip2 and
wasm32-wasip3, and wasmtime 50.0.1, which runs what it builds;
wasm32-wasip3, with the release's platform-independent sysroot (below),
and wasmtime 50.0.1, which runs what it builds;
- for emscripten, Emscripten 6.0.11 from emsdk, and Node, which runs what it
builds;
- for trystero's native backend, CMake, which builds libdatachannel 0.24.6 and
Expand Down Expand Up @@ -145,8 +146,18 @@ with `python3 tools/openssl/update.py` after changing the source commit.
### WebAssembly

Each library declares the targets it is built for. To build them for
wasm32-wasip2 and wasm32-wasip3, register two clang toolsets against
wasi-sdk 34 in `~/user-config.jam`:
wasm32-wasip2 and wasm32-wasip3, install wasi-sdk 34 in `.local/wasi-sdk`
from the superproject's root, as the CI does:

bash tools/ci/actions/wasi-sdk/install.sh

It installs the build of wasi-sdk for your system and processor, with the
release's platform-independent sysroot and compiler-rt builtins in place of
that build's own, each archive checked against its SHA-256. A per-host
archive's sysroot carries the paths of the machine that built it in its
libraries, so the same WASI program would differ from one host to another;
with the shared sysroot it is the same bytes on every host. Then register
two clang toolsets against it in `~/user-config.jam`:

local wasi-sdk = /path/to/wasi-sdk ;
modules.poke : WASI_SDK : $(wasi-sdk) ;
Expand Down
3 changes: 3 additions & 0 deletions doc/releases/0.1.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ None.
* Fixed a stacked table's caption shrinking to its longest word.
* Added the user's Jamfiles of webcpp::hash, tested as fixtures of a test of the tools.
* Changed the lint's canary-pins rule to read webcpp::hash's detail/canary.h beside webcpp::crypto's.
* Changed wasi-sdk's install to use the release's platform-independent sysroot and builtins, so a WASI program is the same bytes on every host.
* Fixed OpenSSL's libcrypto keeping the temporary directory it was built in; one fixed prefix makes it the same bytes on every build.
* Changed webcpp.size-table's tables and webcpp::hash's PBKDF2 throughput table (bench/collect.py) to be built only from release builds.
* Fixed the WASIp2 test launcher interrupting large finite workloads after 60 seconds.
* Fixed Chrome provisioning and browser/TLS profile coverage in Asio CI lanes.
* Added source-built OpenSSL and Cobalt SSL targets for WASIp2.
Expand Down
2 changes: 1 addition & 1 deletion libs/hash
Submodule hash updated 1 files
+41 −1 bench/collect.py
6 changes: 4 additions & 2 deletions tools/ci/actions/wasi-sdk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

name: wasi-sdk
description: >-
Installs wasi-sdk 34.0 in .local/wasi-sdk, checked against its SHA-256: the compiler of the
wasip2 and wasip3 lanes, and the clang-format and clang-tidy of the lint.
Installs wasi-sdk 34.0 in .local/wasi-sdk, the runner's build with the release's
platform-independent sysroot and compiler-rt builtins, each archive checked against its
SHA-256: the compiler of the wasip2 and wasip3 lanes, whose programs are then the same bytes on
every host, and the clang-format and clang-tidy of the lint.

runs:
using: composite
Expand Down
102 changes: 91 additions & 11 deletions tools/ci/actions/wasi-sdk/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,123 @@
# accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)

# The step of tools/ci/actions/wasi-sdk: wasi-sdk 34.0 in .local/wasi-sdk, where the README
# installs it, for the runner's system and processor (RUNNER_OS, RUNNER_ARCH). Its clang++
# builds the wasip2 and wasip3 lanes, which tools/ci/matrix.py registers, and its clang-format
# and clang-tidy are the lint's.
# The step of tools/ci/actions/wasi-sdk, and the install of wasi-sdk on a developer's machine:
# wasi-sdk 34.0 in .local/wasi-sdk, where the README installs it, its clang and tools those of the
# runner's system and processor (RUNNER_OS, RUNNER_ARCH), and its sysroot and its compiler-rt
# builtins the release's platform-independent ones, wasi-sysroot-34.0 and libclang_rt-34.0, on
# every host. Its clang++ builds the wasip2 and wasip3 lanes, which tools/ci/matrix.py registers,
# and its clang-format and clang-tidy are the lint's.
#
# Each per-host archive of wasi-sdk carries a sysroot and builtins of its own build, made on the
# machine that built that archive: wasi-sdk's libc++abi keeps __FILE__ strings with that
# machine's paths (/Users/runner/work/wasi-sdk/... in the macOS archive, /src/... in the Linux
# one), which become bytes of every program that links them. Replacing both with the release's
# platform-independent archives makes a WASI program the same bytes whichever host builds it,
# as webcpp::hash's measured table needs (libs/hash/test/measure).
#
# Usage, from the superproject's root: install.sh
# Outside a runner, RUNNER_OS and RUNNER_ARCH default to this machine's, and RUNNER_TEMP to a
# temporary directory of its own.
set -euo pipefail

if [ -z "${RUNNER_OS-}" ]; then
case "$(uname -s)" in
Darwin) RUNNER_OS=macOS ;;
Linux) RUNNER_OS=Linux ;;
*) RUNNER_OS="$(uname -s)" ;;
esac
fi
if [ -z "${RUNNER_ARCH-}" ]; then
case "$(uname -m)" in
arm64|aarch64) RUNNER_ARCH=ARM64 ;;
x86_64|amd64) RUNNER_ARCH=X64 ;;
*) RUNNER_ARCH="$(uname -m)" ;;
esac
fi

version=34.0
base=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-34
case "${RUNNER_OS}-${RUNNER_ARCH}" in
Linux-X64)
asset=wasi-sdk-34.0-x86_64-linux.tar.gz
asset=wasi-sdk-${version}-x86_64-linux.tar.gz
sha256=b761e3a0721dbae9c09a0059e5fdb2bf917d1b4a8a7b430fb3b5aafb0984b2c4
;;
Linux-ARM64)
asset=wasi-sdk-34.0-arm64-linux.tar.gz
asset=wasi-sdk-${version}-arm64-linux.tar.gz
sha256=f7e243dff54d60bcc576e94d6166b69f410f2500ae4a9ceef34315be10e77971
;;
macOS-ARM64)
asset=wasi-sdk-34.0-arm64-macos.tar.gz
asset=wasi-sdk-${version}-arm64-macos.tar.gz
sha256=9c59398106b417f8f14913380fdf0097a8cc0ff4af9eb3ce0065a859e88d49e9
;;
macOS-X64)
asset=wasi-sdk-34.0-x86_64-macos.tar.gz
asset=wasi-sdk-${version}-x86_64-macos.tar.gz
sha256=87d27fa8adc68dee59bfbf2e22a6d34ef717c34d6bf1d8af2a56fc929d9ce0eb
;;
*)
printf 'install.sh: no wasi-sdk 34.0 is pinned for %s on %s\n' "${RUNNER_OS}" \
"${RUNNER_ARCH}" >&2
printf 'install.sh: no wasi-sdk %s is pinned for %s on %s\n' "${version}" \
"${RUNNER_OS}" "${RUNNER_ARCH}" >&2
exit 1
;;
esac
# The release's platform-independent sysroot and compiler-rt builtins, the same on every host.
sysroot=wasi-sysroot-${version}.tar.gz
sysroot_sha256=9d813544eeebe38b7b8f2244ed591de46b6db812c6dd1a257ff9f0d2a905a2be
builtins=libclang_rt-${version}.tar.gz
builtins_sha256=eee3e634dcf71aa22b1333391623cf5c9965a637dc428a27b1a858c026c587f1

temporary=
if [ -z "${RUNNER_TEMP-}" ]; then
temporary="$(mktemp -d)"
RUNNER_TEMP="${temporary}"
fi
staging=
cleanup() {
rm -f -- "${RUNNER_TEMP}/${asset}" "${RUNNER_TEMP}/${sysroot}" "${RUNNER_TEMP}/${builtins}"
[ -z "${staging}" ] || rm -rf -- "${staging}"
[ -z "${temporary}" ] || rm -rf -- "${temporary}"
}
trap cleanup EXIT

here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
"${here}/../../download.sh" "${base}/${asset}" "${sha256}" "${RUNNER_TEMP}/${asset}"
"${here}/../../download.sh" "${base}/${sysroot}" "${sysroot_sha256}" "${RUNNER_TEMP}/${sysroot}"
"${here}/../../download.sh" "${base}/${builtins}" "${builtins_sha256}" \
"${RUNNER_TEMP}/${builtins}"

rm -rf .local/wasi-sdk
mkdir -p .local/wasi-sdk
tar -xzf "${RUNNER_TEMP}/${asset}" -C .local/wasi-sdk --strip-components=1
rm "${RUNNER_TEMP}/${asset}"
staging="$(mktemp -d "${RUNNER_TEMP}/wasi-sdk-shared.XXXXXX")"
mkdir "${staging}/sysroot" "${staging}/builtins"
tar -xzf "${RUNNER_TEMP}/${sysroot}" -C "${staging}/sysroot" --strip-components=1
tar -xzf "${RUNNER_TEMP}/${builtins}" -C "${staging}/builtins" --strip-components=1

# The sysroot where clang looks for it, <prefix>/share/wasi-sysroot, in place of the archive's.
rm -rf .local/wasi-sdk/share/wasi-sysroot
mv "${staging}/sysroot" .local/wasi-sdk/share/wasi-sysroot

# The builtins of each WebAssembly target, in clang's resource directory, in place of the
# archive's: every target the archive has must be one the platform-independent archive has, so
# that no program links a per-host build of them.
resources=(.local/wasi-sdk/lib/clang/*/lib)
if [ "${#resources[@]}" -ne 1 ] || [ ! -d "${resources[0]}" ]; then
printf 'install.sh: wasi-sdk %s has not one lib/clang/<version>/lib\n' "${version}" >&2
exit 1
fi
for target in "${resources[0]}"/wasm32-*; do
name="$(basename "${target}")"
if [ ! -f "${staging}/builtins/${name}/libclang_rt.builtins.a" ]; then
printf 'install.sh: %s has no builtins for %s\n' "${builtins}" "${name}" >&2
exit 1
fi
done
for target in "${staging}/builtins"/wasm32-*; do
name="$(basename "${target}")"
rm -rf "${resources[0]:?}/${name}"
mv "${target}" "${resources[0]}/${name}"
done

.local/wasi-sdk/bin/clang++ --version
printf 'install.sh: the sysroot and builtins of wasi-sdk %s are the platform-independent %s and %s\n' \
"${version}" "${sysroot}" "${builtins}"
Loading
Loading