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
6 changes: 6 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ runs:
echo "CC=clang-$v" >> $GITHUB_ENV
echo "AR=llvm-ar-$v" >> $GITHUB_ENV
echo "NM=llvm-nm-$v" >> $GITHUB_ENV
# Note: wasm-component-ld is only needed for Linux because
# currently, wasm32-wasip2 is only tested on Linux. If that changes,
# this step will have to be added to the other targets.
curl -fsSLO https://github.com/bytecodealliance/wasm-component-ld/releases/download/v0.5.15/wasm-component-ld-v0.5.15-x86_64-linux.tar.gz
tar xzf wasm-component-ld-v0.5.15-x86_64-linux.tar.gz
echo "$(pwd)/wasm-component-ld-v0.5.15-x86_64-linux" >> $GITHUB_PATH
if: runner.os == 'Linux'
36 changes: 15 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ jobs:
# wasi-libc builds on these platforms by default.
- name: Build on Linux x86_64
os: ubuntu-24.04
clang_version: 16
upload: linux-x86_64-clang-16
clang_version: 19
upload: linux-x86_64-clang-19
- name: Build on Linux aarch64
os: ubuntu-24.04-arm
clang_version: 16
upload: linux-aarch64-clang-16
clang_version: 19
upload: linux-aarch64-clang-19
- name: Build on macOS aarch64
os: macos-15
clang_version: 15.0.7
llvm_asset_suffix: arm64-apple-darwin22.0
upload: macos-clang-15
- name: Build on Windows x86_64
os: windows-2025
clang_version: 16.0.0
upload: windows-clang-16
clang_version: 20.1.8
upload: windows-clang-20

# Other versions of LLVM
- name: Build with LLVM 11
Expand All @@ -45,20 +45,14 @@ jobs:
upload: linux-x86_64-clang-11
env:
BUILD_LIBSETJMP: no
- name: Build with LLVM 19
os: ubuntu-24.04
clang_version: 19
upload: linux-x86_64-clang-19
env:
MAKE_TARGETS: "default libc_so"
- name: Build with LLVM 18
os: ubuntu-24.04
clang_version: 18
upload: linux-x86_64-clang-18
env:
MAKE_TARGETS: "default libc_so"

# Test various combinations of targets triples.
# Test various combinations of target triples.
#
# Configuration here can happen through `env` which is inherited to
# jobs below. For now this only runs tests on Linux with Clang 16,
Expand All @@ -67,23 +61,23 @@ jobs:
# ensure the PIC build works.
- name: Test wasm32-wasi
os: ubuntu-24.04
clang_version: 16
clang_version: 19
test: true
upload: wasm32-wasi
env:
TARGET_TRIPLE: wasm32-wasi
MAKE_TARGETS: "default libc_so"
- name: Test wasm32-wasip1
os: ubuntu-24.04
clang_version: 16
clang_version: 19
test: true
upload: wasm32-wasip1
env:
TARGET_TRIPLE: wasm32-wasip1
MAKE_TARGETS: "default libc_so"
- name: Test wasm32-wasip2
os: ubuntu-24.04
clang_version: 16
clang_version: 19
test: true
upload: wasm32-wasip2
env:
Expand All @@ -92,30 +86,30 @@ jobs:
MAKE_TARGETS: "default libc_so"
- name: Test wasm32-wasi-threads
os: ubuntu-24.04
clang_version: 16
clang_version: 19
test: true
upload: wasm32-wasi-threads
env:
TARGET_TRIPLE: wasm32-wasi-threads
THREAD_MODEL: posix
- name: Test wasm32-wasip1-threads
os: ubuntu-24.04
clang_version: 16
clang_version: 19
test: true
upload: wasm32-wasip1-threads
env:
TARGET_TRIPLE: wasm32-wasip1-threads
THREAD_MODEL: posix
- name: Test wasm32-wasip1 in V8
os: ubuntu-24.04
clang_version: 16
clang_version: 19
test: true
test_with_v8: true
env:
TARGET_TRIPLE: wasm32-wasip1
- name: Test wasm32-wasip1-threads in V8
os: ubuntu-24.04
clang_version: 16
clang_version: 19
test: true
test_with_v8: true
env:
Expand All @@ -124,7 +118,7 @@ jobs:

- name: Test wasm32-wasi-simd
os: ubuntu-24.04
clang_version: 16
clang_version: 19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this version update? If we are bumping the min clang version needed to build libc do we also need to update the docs somewhere?

Should this be its own change, or is it related the wasip2 stuff?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alex suggested the version update in #599 (comment) . It is related to the wasip2 stuff. I thought it made the most sense to update the version for all targets (except the LLVM 11 target).

Currently the root README.md doesn't specify a minimum clang version, although maybe it should?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's required to update to work with wasm32-wasip2, and if we're updating one I figured it was fine to update them all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we still have at least one builder on LLVM 11 then i guess that means we are still testing the same min version. SGTM.

BTW why do the other needed updating but not that one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I guess its because we don't test any of the p3 stuff with the llvm 11 clang versio. lgtm then.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating other builders is not required, but I'd also say it's more consistent to test the same version in the "main body of tests" instead of having a random mish mash of versions which is a historical record of latest-when-someone-last-touched-this which is tough to explain.

test: true
upload: wasm32-wasi-simd
env:
Expand Down
38 changes: 22 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ MALLOC_IMPL ?= dlmalloc
BUILD_LIBC_TOP_HALF ?= yes
# yes or no
BUILD_LIBSETJMP ?= yes

# Set the default WASI target triple.
TARGET_TRIPLE ?= wasm32-wasi

# Threaded version necessitates a different target, as objects from different
# targets can't be mixed together while linking.
ifeq ($(THREAD_MODEL), posix)
TARGET_TRIPLE = wasm32-wasip1-threads
endif

ifeq ($(WASI_SNAPSHOT), p2)
TARGET_TRIPLE = wasm32-wasip2
endif

# The directory where we will store intermediate artifacts.
OBJDIR ?= build/$(TARGET_TRIPLE)

Expand All @@ -46,19 +60,6 @@ BULK_MEMORY_THRESHOLD ?= 32
# Variables from this point on are not meant to be overridable via the
# make command-line.

# Set the default WASI target triple.
TARGET_TRIPLE ?= wasm32-wasi

# Threaded version necessitates a different target, as objects from different
# targets can't be mixed together while linking.
ifeq ($(THREAD_MODEL), posix)
TARGET_TRIPLE ?= wasm32-wasi-threads
endif

ifeq ($(WASI_SNAPSHOT), p2)
TARGET_TRIPLE ?= wasm32-wasip2
endif

# These artifacts are "stamps" that we use to mark that some task (e.g., copying
# files) has been completed.
INCLUDE_DIRS := $(OBJDIR)/copy-include-headers.stamp
Expand Down Expand Up @@ -596,7 +597,9 @@ PIC_OBJS = \
# exists that should be used instead.
SYSTEM_BUILTINS_LIB := $(shell ${CC} ${CFLAGS} --print-libgcc-file-name)
SYSTEM_RESOURCE_DIR := $(shell ${CC} ${CFLAGS} -print-resource-dir)
BUILTINS_LIB_REL := $(subst $(SYSTEM_RESOURCE_DIR),,$(SYSTEM_BUILTINS_LIB))
BUILTINS_LIB_REL_1 := $(subst $(SYSTEM_RESOURCE_DIR),,$(SYSTEM_BUILTINS_LIB))
# Substitute '/' for '\' so Windows paths work
BUILTINS_LIB_REL := $(subst \,/,$(BUILTINS_LIB_REL_1))
TMP_RESOURCE_DIR := $(OBJDIR)/resource-dir
BUILTINS_LIB_PATH := $(TMP_RESOURCE_DIR)/$(BUILTINS_LIB_REL)
BUILTINS_LIB_DIR := $(dir $(BUILTINS_LIB_PATH))
Expand All @@ -610,7 +613,10 @@ else
BUILTINS_URL := https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/libclang_rt.builtins-wasm32-wasi-25.0.tar.gz

$(BUILTINS_LIB_PATH):
mkdir -p $(BUILTINS_LIB_DIR)
# mkdir on Windows will error if the directory already exists
ifeq ("$(wildcard $(BUILTINS_LIB_DIR))","")
mkdir -p "$(BUILTINS_LIB_DIR)"
endif
curl -sSfL $(BUILTINS_URL) | \
tar xzf - -C $(BUILTINS_LIB_DIR) --strip-components 1
if [ ! -f $(BUILTINS_LIB_PATH) ]; then \
Expand Down Expand Up @@ -850,7 +856,7 @@ STATIC_LIBS += \
$(SYSROOT_LIB)/libsetjmp.a
endif

libc: $(INCLUDE_DIRS) $(STATIC_LIBS)
libc: $(INCLUDE_DIRS) $(STATIC_LIBS) builtins

DUMMY := m rt pthread crypt util xnet resolv
DUMMY_LIBS := $(patsubst %,$(SYSROOT_LIB)/lib%.a,$(DUMMY))
Expand Down
16 changes: 16 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ test: run
# Decide which target to build for and which libc to use.
TARGET_TRIPLE ?= wasm32-wasi

# See comment in ../Makefile
ifeq ($(THREAD_MODEL), posix)
TARGET_TRIPLE = wasm32-wasip1-threads
endif

ifeq ($(WASI_SNAPSHOT), p2)
TARGET_TRIPLE = wasm32-wasip2
endif

# Setup various paths used by the tests.
OBJDIR ?= build/$(TARGET_TRIPLE)
DOWNDIR ?= build/download
Expand Down Expand Up @@ -135,6 +144,13 @@ $(BUILTINS_STAMP):
make -C .. builtins
touch $@

# For wasip2, we want clang to generate a core module rather than a component,
# because `wasm-tools component new` is called subsequently and it expects
# a core module.
ifeq ($(TARGET_TRIPLE), wasm32-wasip2)
LDFLAGS += -Wl,--skip-wit-component
endif

# Build up all the `*.wasm.o` object files; these are the same regardless of
# whether we're building core modules or components.
$(WASM_OBJS): $(INFRA_HEADERS)
Expand Down