From 17c1fc74b2210f9a17b6721370abc07376b1a81b Mon Sep 17 00:00:00 2001 From: "LocalAI [bot]" <139863280+localai-bot@users.noreply.github.com> Date: Fri, 26 Jun 2026 22:31:06 +0200 Subject: [PATCH] fix(backends): darwin packaging for silero-vad (last Linux-only Go backend) (#10528) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(backends): darwin packaging for silero-vad silero-vad was the last Go backend with Linux-only darwin packaging: - package.sh fell through to "Could not detect architecture" -> exit 1 on macOS (no Darwin branch), so its darwin image never packaged. - run.sh exported LD_LIBRARY_PATH, which macOS dyld ignores, so the bundled libonnxruntime.dylib couldn't be found at runtime. Add a Darwin branch to package.sh (skip the glibc/ld.so bundling; add an @loader_path/lib rpath so @rpath resolves to package/lib/) and a DYLD_LIBRARY_PATH branch to run.sh — mirroring the piper darwin fix (#10525). Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto Co-authored-by: Ettore Di Giacinto --- backend/go/silero-vad/package.sh | 9 ++++++++- backend/go/silero-vad/run.sh | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/go/silero-vad/package.sh b/backend/go/silero-vad/package.sh index bec3150d5..a96ff4c8b 100755 --- a/backend/go/silero-vad/package.sh +++ b/backend/go/silero-vad/package.sh @@ -15,7 +15,14 @@ cp -avf $CURDIR/run.sh $CURDIR/package/ cp -rfLv $CURDIR/backend-assets/lib/* $CURDIR/package/lib/ # Detect architecture and copy appropriate libraries -if [ -f "/lib64/ld-linux-x86-64.so.2" ]; then +if [ "$(uname)" = "Darwin" ]; then + # macOS has no glibc loader to bundle. silero-vad links its bundled + # libonnxruntime via @rpath but ships with no LC_RPATH, so dyld can't find + # it at runtime. Add an @loader_path/lib rpath so @rpath resolves to + # package/lib/ (matching the piper darwin fix, #10525). + echo "Detected macOS; adding @loader_path/lib rpath so bundled libs resolve via @rpath..." + install_name_tool -add_rpath @loader_path/lib "$CURDIR/package/silero-vad" +elif [ -f "/lib64/ld-linux-x86-64.so.2" ]; then # x86_64 architecture echo "Detected x86_64 architecture, copying x86_64 libraries..." cp -arfLv /lib64/ld-linux-x86-64.so.2 $CURDIR/package/lib/ld.so diff --git a/backend/go/silero-vad/run.sh b/backend/go/silero-vad/run.sh index d8c343223..0508420e5 100755 --- a/backend/go/silero-vad/run.sh +++ b/backend/go/silero-vad/run.sh @@ -3,7 +3,11 @@ set -ex CURDIR=$(dirname "$(realpath "$0")") -export LD_LIBRARY_PATH="$CURDIR"/lib:$LD_LIBRARY_PATH +if [ "$(uname)" = "Darwin" ]; then + export DYLD_LIBRARY_PATH="$CURDIR"/lib:$DYLD_LIBRARY_PATH +else + export LD_LIBRARY_PATH="$CURDIR"/lib:$LD_LIBRARY_PATH +fi # If there is a lib/ld.so, use it if [ -f "$CURDIR"/lib/ld.so ]; then