Add WASI_SDK_BUILD_SHARED option#632
Merged
alexcrichton merged 1 commit intoMay 16, 2026
Merged
Conversation
e358ce9 to
10801a8
Compare
Adds a new top-level CMake option, defaulting to ON to preserve existing behavior. When set to OFF:
* wasi-libc is built with -DBUILD_SHARED=OFF regardless of LTO state.
* libcxx/libcxxabi/libunwind ExternalProject_Add invocations no longer use ${pic} directly for
their *_ENABLE_SHARED flags; they go through a local `shared` variable that AND's
WASI_SDK_BUILD_SHARED with ${pic}.
This lets downstream consumers that build wasi-sdk from source as part of a larger toolchain
pipeline produce a static-only sysroot without patching locally.
A 'static' entry is added to the build-only-sysroot CI matrix to exercise the OFF path.
10801a8 to
dc47eac
Compare
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.
Adds a new CMake option, defaulting to
ONso existing builds are unaffected. When set toOFF,wasi-libcis built with-DBUILD_SHARED=OFF(its existingif (NOT BUILD_SHARED)block then short-circuits the per-targetset(SHARED ON)forwasm32-wasi/wasm32-wasip1), and thelibcxx/libcxxabi/libunwindinvocations no longer use${pic}directly for their*_ENABLE_SHAREDflags — they go through a new localsharedvariable that AND'sWASI_SDK_BUILD_SHAREDwith${pic}.Motivation: downstream consumers that build wasi-sdk from source as part of a larger toolchain pipeline (in our case, Firefox's build system) don't ship or link against shared sysroot artifacts. The current code path provides no way to opt out, so we've been patching locally. The existing comment in
wasi-sdk-sysroot.cmakenotes shared libraries aren't supported with LTO; this doesn't change that default, it just exposes the same toggle for non-LTO builds too.A
staticentry is added to thebuild-only-sysrootCI matrix to exercise the OFF path.