feat: add musl (Alpine Linux) support and packaging - #2539
feat: add musl (Alpine Linux) support and packaging#2539clemperorpenguin wants to merge 4 commits into
Conversation
|
PR depends on merges: Set LEMONADE_BACKEND_REPO_OWNER=clemperorpenguin for testing :) Note: I can't get the whisper CI to pass, not sure why. Windows NPU builds for a day and then cancels the job. |
fl0rianr
left a comment
There was a problem hiding this comment.
Thanks for pushing Alpine/musl support — the APK/Docker direction is good and the llama.cpp CPU/Vulkan smoke coverage is useful. I don’t think this is merge-ready yet.
Blocking issues:
-
Dockerfile.alpine bakes LEMONADE_BACKEND_REPO_OWNER=clemperorpenguin into the runtime image. That makes official images fetch backend binaries from a personal fork by default. Please default this to empty and only pass it explicitly in temporary CI/testing, or remove it once the companion asset PRs have landed.
-
The OpenRC service does not export XDG_RUNTIME_DIR or RUNTIME_DIRECTORY, while the Linux runtime-dir resolver requires one of them. The APK CI only tests direct lemond startup with a manually exported XDG_RUNTIME_DIR, so it does not cover the documented rc-service lemonade-server start path.
-
musl hosts can still select/download glibc Linux assets for some backends, especially llamacpp CUDA/ROCm and whispercpp ROCm. Please either mark those variants unsupported on musl or remap them consistently, and add install-param tests that assert musl never resolves Ubuntu/glibc asset names.
-
The PR depends on several unmerged backend release PRs for the musl assets. Please merge/release those first or keep this PR non-mergeable until the assets are available from official repos.
Also please reconcile the aarch64 descriptor support with the newly added aarch64 asset names and update the Dockerfile/README wording around Moonshine.
fl0rianr
left a comment
There was a problem hiding this comment.
Thanks for the updates — the main blockers from my previous review are addressed now.
Remaining open points:
- The companion backend asset PRs still need to land I guess you have this in plan
- Please remove the temporary fork build-arg from the Alpine Docker smoke workflow once the companion assets are upstream.
After those move forward, I’m approving this.
Add compile-time libc detection in platform.h (LEMON_LINUX_MUSL) and a musl asset resolver so backend downloads select musl builds on Alpine. Backend descriptors omit recipes that ship glibc-only assets (llama.cpp cuda/rocm, sd.cpp cuda/rocm, whisper.cpp rocm) on musl, so a musl host never offers a backend it cannot download. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Add an APKBUILD with build/install scripts, an OpenRC init script, and a Dockerfile.alpine for musl builds. setup.sh learns apk package mappings; libsystemd is skipped since Alpine has no systemd. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Assert a musl host never resolves a glibc ("ubuntu") asset and that
backends with no musl build throw. Arch is a parameter, so the test runs
on any libc. Registered with add_cpp_ci_test(... CI ON) so it runs under
the cpp-ci CTest label.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Build and smoke-test the APK on x86_64 and aarch64, exercising both the installed package and the OpenRC service path. The APK job follows the deferred-CI convention: it is gated behind ci:distros on pull requests and reports through an "Alpine APK builds" aggregate check. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
I've thought about this more, it will either add tech debt to lemonade or to ggml, and I do not know that there is much demand for an Alpine package at this point - ROCm is not even fully packaged on Alpine yet afaik. Further, with custom backends being discussed/upcoming, and recent development of https://github.com/pg83/solo , I'm not sure if native musl support makes sense at this time without a way to run the glibc binaries (like with solo). Closing for now to refocus on other priorities. |
This PR adds support for building and running lemonade on musl-based Linux (Alpine), covering both the C++ server and native packaging. llama.cpp (CPU + Vulkan) is verified working on Alpine; the remaining backends are in progress.
What's included:
Depends on:
Companion changes to the backend release repos publish the …-musl-… assets (separate PRs). backend_versions.json intentionally unchanged.
Status:
llama.cpp CPU + Vulkan verified on Alpine; sd.cpp / whisper / Kokoro / moonshine in progress.
Cross-platform safety:
All C++ changes are #ifdef LEMON_LINUX_MUSL-guarded; shell changes are apk-only. glibc / Windows / macOS unchanged.