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