fix(toolchain): build the wasi-libc sysroot on bash 3.2 - #1918
Open
WyvernMonarch wants to merge 1 commit into
Open
fix(toolchain): build the wasi-libc sysroot on bash 3.2#1918WyvernMonarch wants to merge 1 commit into
WyvernMonarch wants to merge 1 commit into
Conversation
`patch-wasi-libc.sh` collected its patch list with `mapfile`, a bash 4 builtin. macOS ships bash 3.2 as /bin/bash, which the script's shebang selects, so `make -C toolchain/c sysroot` died immediately with "mapfile: command not found" (exit 127) before applying a single patch — the wasm command set could not be built on darwin at all. Read the list with a `while IFS= read -r` loop instead. Same ordering (forward for apply/check, reverse for reverse), same empty-list handling, and no bash-4 builtins. Avoids passing an empty array under `set -u`, which bash 3.2 also rejects, by selecting the sort order with a function rather than an argument array. Verified: `make -C toolchain/c sysroot` now completes (exit 0) on darwin 24.1 / bash 3.2, and `make pr-commands` builds 101 wasm binaries on top of the resulting sysroot.
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.
Summary
patch-wasi-libc.shusesmapfile(a bash 4 builtin) under a#!/bin/bashshebang. macOS ships bash 3.2 at/bin/bash, so the sysroot build dies with exit 127 before applying any patch — the wasm command set cannot be built on darwin at all. This rewrites themapfileusage in bash-3.2-compatible form; behavior on bash 4+ is unchanged.Found while building the wasm coreutils payload on a mac; with this fix the full sysroot + command-set build completes on stock macOS bash.
🤖 Generated with Claude Code