Skip to content

Add Alpine musl support with a custom Go toolchain - #465

Closed
teta2k wants to merge 2 commits into
mainfrom
feat/alpine-musl-go-pr-75048
Closed

Add Alpine musl support with a custom Go toolchain#465
teta2k wants to merge 2 commits into
mainfrom
feat/alpine-musl-go-pr-75048

Conversation

@teta2k

@teta2k teta2k commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a dedicated Alpine/musl build for amd64 and arm64
  • build every Alpine Go artifact and build tool with an exact pinned custom Go toolchain; checksum-pinned Go 1.26.7 is used only to bootstrap that compiler
  • force external linking for Alpine Go tests and artifacts so the optional glibc probe remains a weak symbol on musl
  • verify the c-shared request processor with a real musl dlopen
  • build PHP 8.2-8.5 NTS/ZTS extensions and package the artifacts as an APK
  • select the correct musl or glibc Zen Internals library at runtime
  • include the Alpine build in releases

This is a replacement for #400, rebuilt from current main.

Custom Go toolchain

The Alpine build temporarily depends on an unmerged Go runtime and linker change for loading C-shared libraries on musl. The builder pins the exact reviewed source commit instead of following a mutable branch. This should remain a draft while we review the risk of shipping an unmerged toolchain and collect CI evidence for both architectures.

The custom toolchain uses a weak reference to glibc's gnu_get_libc_version for runtime libc detection. In an ordinary cgo test executable, Go's default linker emits that reference as GLOBAL UND, so musl refuses to start the binary with gnu_get_libc_version: symbol not found. External linking preserves it as WEAK UND, as intended. The Alpine build therefore uses the custom compiler throughout and explicitly selects external linking for tests and shipped Go artifacts.

Local validation

  • GitHub workflow lint passed with actionlint v1.7.12
  • APK lifecycle scripts passed sh -n on Alpine 3.22
  • amd64 Alpine builder passed both Go test suites using the custom compiler and external linking
  • the agent and request processor report the pinned custom Go version
  • the agent and request processor are dynamically linked against musl
  • the request processor passed a real dlopen smoke test under musl
  • PHP 8.4 NTS extension compiled and loaded under Alpine

The arm64 build, full PHP NTS/ZTS matrix, APK build, and APK install/remove checks are delegated to this draft's CI.

@teta2k teta2k changed the title Add Alpine musl support using Go PR #75048 Add Alpine musl support with a custom Go toolchain Aug 26, 2026
@teta2k teta2k closed this Aug 26, 2026
@teta2k
teta2k deleted the feat/alpine-musl-go-pr-75048 branch August 26, 2026 12:35
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