Skip to content

sdk: report Kandelo's musl userland truthfully to Autoconf - #883

Closed
brandonpayton wants to merge 3 commits into
fix/sdk-config-absent-functionsfrom
fix/sdk-autoconf-musl-host
Closed

sdk: report Kandelo's musl userland truthfully to Autoconf#883
brandonpayton wants to merge 3 commits into
fix/sdk-config-absent-functionsfrom
fix/sdk-autoconf-musl-host

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Jul 11, 2026

Copy link
Copy Markdown
Member

Why

The software development kit (SDK) identifies Kandelo to package configure scripts. musl is Kandelo's C standard library, while GNU Autoconf and gnulib use the reported target name to choose compatible source code.

Report the SDK's real musl userland identity to GNU build systems so Autoconf and gnulib choose musl behavior instead of treating Kandelo as an unknown libc.

GNU M4 made the mismatch visible: wasm32posix-configure reported --host=wasm32-unknown-none, so gnulib did not define MUSL_LIBC even though the SDK links musl. Correcting the identity also exposed an upstream PHP cross-compilation assumption: PHP treats every *linux* host as glibc and selects an off64_t * fopencookie callback, while musl truthfully uses off_t *.

What changed

  • Use wasm*-unknown-linux-musl as the GNU/Autoconf host identity.
  • Keep wasm*-unknown-unknown as Clang's code-generation triple.
  • Name, document, and test those two separate contracts for wasm32 and wasm64.
  • In PHP's generated cross-build config, preserve real HAVE_FOPENCOOKIE support but undefine only the glibc-specific COOKIE_SEEKER_USES_OFF64_T choice.
  • Fail the PHP build if either generated-header invariant is lost, and force the affected stream-casting object to rebuild.

GNU config.sub requires a Linux kernel component for a musl tuple. This describes the musl userland; it does not define __linux__, change Kandelo's syscall contract, or promise Linux kernel behavior. The PHP adjustment is an upstream cross-compilation compatibility fix, not a substitute for missing Kandelo functionality.

Validation

Final candidate: a98bd0d7235075e638aab779ee4785cc44e6e78b (tree 0feb3d28b7aac6e7bd0a85da7d31a5eae638639e).

  • The exact final head built PHP 8.3.15 CLI, FPM, and all declared extensions from source after both fopencookie assertions passed.
  • The resulting php.wasm and php-fpm.wasm were optimized, fork-instrumented, and validated as ABI 39 program artifacts.
  • After a fresh ABI-39 rootfs build, the focused Kandelo runtime test executed the freshly rebuilt php -r artifact and passed.
  • A direct SDK compile confirmed musl accepts the off_t * callback and rejects PHP's glibc-only off64_t * callback.
  • SDK Vitest on the preceding target-identity head passed 7 files and 74 tests, including sdk: preserve static linker argument order #913 linker-order and sdk: centralize cross-compile function availability #874 target-fact coverage.
  • ABI consistency passed; this changes no ABI surface.
  • Final-head bash -n and git diff --check passed.
  • Independent review accepted the exact final head and confirmed the PHP correction belongs with the target-identity change.

Hosted staging is running on this exact head. The preceding run rebuilt curl with the truthful wasm32-unknown-linux-musl identity and exposed one stale registry test expectation; that expectation is now folded into the original target-identity commit. The other 1,406 Vitest cases and the package/library matrix passed in that run.

Consumer evidence on the earlier target-identity head also includes source builds and literal Kandelo runtime tests for GNU Grep, GNU Sed, GNU M4, and XZ.

Contract impact

This changes SDK configure metadata and one upstream PHP cross-build decision. It changes no syscall, channel, memory layout, host runtime, browser behavior, or ABI version. Node and browser hosts consume the same resulting Wasm contract.

Merge ordering

This PR is stacked on #874, which is stacked on #913. Merge #913, then #874, then retarget this PR to main. GNU M4 and other consumers require #874's authoritative sdk/config.site facts beneath this host identity; without them, Kandelo's allow-undefined link mode can create false-positive function probes.

This is a main-repository PR for review and must not be auto-merged.

@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Phase B-1 matrix build status — pr-883-staging

ABI v39. 71 built, 0 failed, 71 total.

Package Arch Status Sha
icu wasm32 built 5ff9ee8d
libcurl wasm32 built 0b1b1671
libcxx wasm32 built 264bead6
libcxx wasm64 built 0a1af93a
libiconv wasm32 built 560b07f2
libpng wasm32 built eb91c16b
libxml2 wasm32 built f7b57dc8
libzip wasm32 built 81c1337b
openssl wasm32 built c08ae93b
openssl wasm64 built 73478b9f
sqlite wasm32 built 21ab1f0c
sqlite wasm64 built bb235497
zlib wasm32 built 242b4b6c
zlib wasm64 built 277c6ac7
bc wasm32 built d26e2827
bzip2 wasm32 built ec8d1452
coreutils wasm32 built 63821f2c
curl wasm32 built 095be673
dash wasm32 built 417065a9
diffutils wasm32 built d0f1fde0
dinit wasm32 built 18d4e737
fbdoom wasm32 built 23d90bea
file wasm32 built 106ea18c
findutils wasm32 built 84ae9303
gawk wasm32 built 2e0cbf19
git wasm32 built 32505568
grep wasm32 built 86e9a832
gzip wasm32 built 87e3edf0
hello wasm32 built eeda49a5
kandelo-sdk wasm32 built 1c07b3f1
kernel wasm32 built 66f5a872
less wasm32 built 82cf7855
lsof wasm32 built 813e02a9
m4 wasm32 built c5c145bd
make wasm32 built bb0baede
mariadb wasm32 built 4c9d0701
mariadb wasm64 built c40f13e1
modeset wasm32 built f6bf2b67
msmtpd wasm32 built 65978078
nano wasm32 built 520fca7a
ncurses wasm32 built 549cc665
netcat wasm32 built 9bc9ff6c
nginx wasm32 built fb5d0866
php wasm32 built 506473b2
posix-utils-lite wasm32 built cab59030
ruby wasm32 built 3f1d1019
sed wasm32 built 73ee890d
spidermonkey wasm32 built 59cda6fd
tar wasm32 built 19723213
tcl wasm32 built 82b99ef7
unzip wasm32 built ebf0baaf
userspace wasm32 built 6195dcb4
vim wasm32 built 61c88ab1
wget wasm32 built d45f15b8
xz wasm32 built 62b860c9
zip wasm32 built 589eaae7
zstd wasm32 built 3b57442d
bash wasm32 built 727ab35e
mariadb-test wasm32 built 53c2d150
mariadb-vfs wasm32 built bf4404a8
mariadb-vfs wasm64 built 9fd67b54
nethack wasm32 built da9c9092
node wasm32 built ffbc0dab
spidermonkey-node wasm32 built 532c3d92
vim-browser-bundle wasm32 built 678247c1
nethack-browser-bundle wasm32 built 56b84057
rootfs wasm32 built 91af3bbe
shell wasm32 built daae0d15
lamp wasm32 built 60ccb85d
node-vfs wasm32 built 918187b5
wordpress wasm32 built 65df6293

Auto-generated; replaced on each push. Raw data in the publish-status workflow artifact.

@brandonpayton

Copy link
Copy Markdown
Member Author

Controlled Homebrew consumer evidence at exact head ac91610ca484bae679bd6eb08a6e1bcfed47d111:

No tap formula workaround such as -DMUSL_LIBC was present: the installed Cellar recipe is byte-identical to the live formula (SHA-256 29d490bdb9c272b0c561cd764a9f4784a8284a12b74c460163147e2f7bb9f73a). No ABI change was used. This is source-build evidence only; it does not claim a bottle or guest pour.

@brandonpayton
brandonpayton force-pushed the fix/sdk-autoconf-musl-host branch from ac91610 to 7142f95 Compare July 14, 2026 03:00
@brandonpayton
brandonpayton changed the base branch from main to fix/sdk-config-absent-functions July 14, 2026 03:00
@brandonpayton brandonpayton changed the title SDK: identify Kandelo's musl userland to Autoconf sdk: identify Kandelo's musl userland to Autoconf Jul 14, 2026
@brandonpayton brandonpayton changed the title sdk: identify Kandelo's musl userland to Autoconf sdk: report Kandelo's musl userland truthfully to Autoconf Jul 14, 2026
GNU build systems need an accepted musl host tuple to select the libc behavior provided by Kandelo's sysroot. Keep LLVM code generation on wasm-unknown-unknown and use wasm-unknown-linux-musl only for Autoconf host identity, without defining __linux__ or promising Linux kernel behavior.
GNU Netcat 0.7.1 ships config.sub and config.guess files that predate Wasm musl tuples. Replace both from the pinned Automake build input before configure, let config.guess detect the real POSIX build host, and bump the package revision for the changed output.
@brandonpayton
brandonpayton force-pushed the fix/sdk-autoconf-musl-host branch from ef282b4 to a98bd0d Compare July 14, 2026 11:27
@brandonpayton

Copy link
Copy Markdown
Member Author

Absorbed by rebase-merged #967. Main is now 6efb411 with the sealed tree b133bfa018f7e2bc84c4845edf2f945b2f844954, and ABI 41 activation completed successfully in run 29550069085. The absorption audit confirmed this PR\x27s behavior and tests are present in that merged tree, so this source PR is closed and its branch is deleted.

@brandonpayton
brandonpayton deleted the fix/sdk-autoconf-musl-host branch July 17, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant