发布

  • fix(backends): make the opus backend build and package on macOS/Darwin (#10523)

    frostbyte_neo 发布于 2026-06-26 09:19:50 +00:00 | 1113 次提交 在此版本后已推送到 master

    The opus Go backend (WebRTC audio codec) never built on macOS, so the
    published master-metal-darwin-arm64-opus image shipped source only — no
    opus binary and no libopusshim — because every step assumed Linux.

    • Makefile: hardcoded libopusshim.so with no OS handling. Mirror
      sherpa-onnx: SHIM_EXT=so / dylib on Darwin and build
      libopusshim.$(SHIM_EXT). On Darwin link the shim with
      -undefined dynamic_lookup so it resolves opus_encoder_ctl from the
      already globally-loaded libopus (codec.go dlopens it RTLD_GLOBAL
      first) instead of baking an absolute Homebrew path into the dylib,
      keeping the packaged shim relocatable.
    • run.sh: hardcoded LD_LIBRARY_PATH + libopusshim.so even on macOS. Add
      a Darwin branch exporting DYLD_LIBRARY_PATH and the .dylib shim, like
      sherpa-onnx/run.sh.
    • package.sh: bundle libopusshim.$(SHIM_EXT) and libopus*.dylib (not
      just .so) into package/lib so the OCI image (which ships package/.)
      is self-contained on a runtime with no Homebrew; add a Darwin arch
      branch so it doesn't warn/skip.
    • backend_build_darwin.yml: install + link opus and pkg-config via brew
      so the Makefile's pkg-config opus resolves on the macOS runner, and
      cache opus' Cellar dir.

    Go code is unchanged; darwin build is validated in CI.

    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

    下载附件