Skip to content

Commit 17c1fc7

Browse files
localai-botmudler
andauthored
fix(backends): darwin packaging for silero-vad (last Linux-only Go backend) (#10528)
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 <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 068d397 commit 17c1fc7

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

backend/go/silero-vad/package.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ cp -avf $CURDIR/run.sh $CURDIR/package/
1515
cp -rfLv $CURDIR/backend-assets/lib/* $CURDIR/package/lib/
1616

1717
# Detect architecture and copy appropriate libraries
18-
if [ -f "/lib64/ld-linux-x86-64.so.2" ]; then
18+
if [ "$(uname)" = "Darwin" ]; then
19+
# macOS has no glibc loader to bundle. silero-vad links its bundled
20+
# libonnxruntime via @rpath but ships with no LC_RPATH, so dyld can't find
21+
# it at runtime. Add an @loader_path/lib rpath so @rpath resolves to
22+
# package/lib/ (matching the piper darwin fix, #10525).
23+
echo "Detected macOS; adding @loader_path/lib rpath so bundled libs resolve via @rpath..."
24+
install_name_tool -add_rpath @loader_path/lib "$CURDIR/package/silero-vad"
25+
elif [ -f "/lib64/ld-linux-x86-64.so.2" ]; then
1926
# x86_64 architecture
2027
echo "Detected x86_64 architecture, copying x86_64 libraries..."
2128
cp -arfLv /lib64/ld-linux-x86-64.so.2 $CURDIR/package/lib/ld.so

backend/go/silero-vad/run.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ set -ex
33

44
CURDIR=$(dirname "$(realpath "$0")")
55

6-
export LD_LIBRARY_PATH="$CURDIR"/lib:$LD_LIBRARY_PATH
6+
if [ "$(uname)" = "Darwin" ]; then
7+
export DYLD_LIBRARY_PATH="$CURDIR"/lib:$DYLD_LIBRARY_PATH
8+
else
9+
export LD_LIBRARY_PATH="$CURDIR"/lib:$LD_LIBRARY_PATH
10+
fi
711

812
# If there is a lib/ld.so, use it
913
if [ -f "$CURDIR"/lib/ld.so ]; then

0 commit comments

Comments
 (0)