fix(backends): darwin/metal support for supertonic#10488
Merged
Conversation
The supertonic Go TTS backend dlopens ONNX Runtime, but its runtime and packaging scripts were Linux-only: run.sh exported LD_LIBRARY_PATH, pointed ONNXRUNTIME_LIB_PATH at libonnxruntime.so, and always tried the ld.so exec path, while package.sh hard-failed on any non-Linux host. On macOS dyld has no ld.so loader, uses DYLD_LIBRARY_PATH, and ONNX Runtime ships as a .dylib. This applies the same purego .dylib/DYLD_LIBRARY_PATH fix that PR #10481 landed for 15 other ONNX/purego backends (sherpa-onnx, silero-vad, etc.) but which omitted supertonic: - run.sh: on darwin export DYLD_LIBRARY_PATH and point ONNXRUNTIME_LIB_PATH at libonnxruntime.dylib; guard the ld.so exec path to Linux only. - package.sh: recognize Darwin instead of erroring out; the bundled .dylib is resolved via DYLD_LIBRARY_PATH, no glibc/ld.so to bundle. - helper.go: platform-native default library extension (dylib on darwin) for the last-resort dlopen fallback. It also wires the darwin CI build and gallery entries, resolving the inconsistency where backend/index.yaml advertised metal for supertonic but no includeDarwin matrix entry built the image: - .github/backend-matrix.yml: add the -metal-darwin-arm64-supertonic Go entry. - backend/index.yaml: declare metal capabilities and add the concrete metal-supertonic / metal-supertonic-development child entries. The Makefile already detects Darwin/osx/arm64 and stages the per-OS ONNX Runtime tarball, mirroring sherpa-onnx, so no Makefile change is required. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:opus-4.8 [Claude Code]
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.
What
Adds macOS (darwin-arm64 / Metal) build and runtime support to the supertonic Go TTS backend, which dlopens ONNX Runtime via purego (
yalue/onnxruntime_go).The backend's runtime/packaging scripts were Linux-only. This applies the same purego
.dylib/DYLD_LIBRARY_PATHfix that PR #10481 landed for 15 other ONNX/purego backends (sherpa-onnx, silero-vad, etc.) - supertonic was omitted from that PR - and wires the darwin CI build, resolving the inconsistency wherebackend/index.yamladvertisedmetalfor supertonic but noincludeDarwinmatrix entry actually built the image.The 4-layer dylib fix (mirroring sherpa-onnx)
run.sh: on darwin exportDYLD_LIBRARY_PATH(keepLD_LIBRARY_PATHfor Linux), pointONNXRUNTIME_LIB_PATHatlibonnxruntime.dylib, and guard theld.soexec path to Linux only (macOS has nold.soloader).package.sh: recognizeDarwin(elif [ $(uname -s) = "Darwin" ]) instead of erroring out; the bundled.dylibis resolved viaDYLD_LIBRARY_PATH, with no glibc/ld.soto bundle.helper.go: platform-native default library extension (.dylibonruntime.GOOS == "darwin",.soelsewhere) for the last-resort dlopen fallback. Build-tag-free, compiles on both OSes.Darwin/osx/arm64and stages the per-OS ONNX Runtime tarball (backend-assets/libcopiessources/onnxruntime/lib/*, which is.dylibon macOS), exactly like sherpa-onnx.CI / gallery wiring
.github/backend-matrix.yml: add the-metal-darwin-arm64-supertonicentry toincludeDarwin(lang: "go",build-type: "metal").backend/index.yaml: declaremetalcapabilities on thesupertonicandsupertonic-developmententries, and add the concretemetal-supertonic/metal-supertonic-developmentchild entries (mirroringmetal-sherpa-onnx).Verification
python3 -c "import yaml; yaml.safe_load(...)"passes for bothbackend/index.yamland.github/backend-matrix.yml.go build ./...aftermake protogen-go);go vetis clean.Assisted-by: Claude:opus-4.8 [Claude Code]