Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(build): pin the macOS deployment target for ffmpeg and whisper

Etienne Lescot7d69edb0c730
diff --git a/scripts/build-whisper-stt.sh b/scripts/build-whisper-stt.sh
index dc4728141..71cfa6e6f 100644
--- a/scripts/build-whisper-stt.sh
+++ b/scripts/build-whisper-stt.sh
@@ -73,6 +73,11 @@ os_arch_tag() {
readonly OS_ARCH="$(os_arch_tag)"
readonly OUT_DIR="${OUT_ROOT}/${OS_ARCH}"
+# Kept beside the other build constants so it is greppable next to the ffmpeg one in
+# scripts/fetch-ffmpeg-macos.mjs; the two must agree, and both must be <= the app's
+# LSMinimumSystemVersion.
+readonly MACOS_DEPLOYMENT_TARGET="12.0"
+
# Determine the default backend flag for this host.
backend_flag_for_host() {
case "${OS_ARCH}" in
@@ -305,6 +310,21 @@ BUILD_FLAGS=()
if [[ -n "${DEFAULT_FLAG}" ]]; then
BUILD_FLAGS+=("${DEFAULT_FLAG}")
fi
+# Pin the macOS floor the app actually ships against (Electron's own
+# LSMinimumSystemVersion, and what README/installation.md promise). Without it CMake
+# defaults the deployment target to the BUILD MACHINE's SDK, so whisper-stt-server and
+# the libwhisper/libggml*/libparakeet dylibs inherit whatever macOS built them —
+# measured 26.0 on the shipped v1.10.0 payload, and ~15.x from CI's `macos-latest`,
+# a floor that moves on its own whenever GitHub rolls that image.
+#
+# This is the macOS twin of the ubuntu-22.04 pin in build-whisper-stt.yml: same defect
+# (a shipped binary's floor decided by the runner rather than by the project), different
+# libc. Note it is NOT a loader version gate — dyld does not refuse a binary whose minos
+# exceeds the running OS. Setting it is what makes the linker enforce macOS 12 symbol
+# availability, which is what actually fails at load time. See issue #515.
+if [[ "${OS_ARCH}" == darwin-* ]]; then
+ BUILD_FLAGS+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOS_DEPLOYMENT_TARGET}")
+fi
# See the comment in build_variant() re: bash 3.2 + `set -u` + empty arrays
# (macOS x64/CPU has no DEFAULT_FLAG, so BUILD_FLAGS is genuinely empty here).
build_variant "default" ${BUILD_FLAGS[@]+"${BUILD_FLAGS[@]}"}
diff --git a/scripts/fetch-ffmpeg-macos.mjs b/scripts/fetch-ffmpeg-macos.mjs
index d611aa627..52563ee97 100644
--- a/scripts/fetch-ffmpeg-macos.mjs
+++ b/scripts/fetch-ffmpeg-macos.mjs
@@ -29,6 +29,18 @@ const ROOT = path.join(__dirname, "..");
const CRATES_DIR = path.join(ROOT, "crates");
/** Pinned release. The directory name is what build.rs looks for. */
+// The macOS floor the app ships against (Electron 41's own LSMinimumSystemVersion, and
+// what README/installation.md promise). Without it, clang defaults the deployment target
+// to the BUILD MACHINE's SDK, so the vendored dylibs inherit whatever macOS built them —
+// measured 26.0 on a local build and ~15.x from CI's `macos-latest`, a floor that moves on
+// its own every time GitHub rolls that image. That is the same class of leak the configure
+// comment below guards against for Homebrew packages, and it is the one it missed.
+//
+// Note this is NOT a loader version gate: dyld does not refuse a dylib whose minos exceeds
+// the running OS (verified). Setting it is what makes the LINKER enforce macOS 12 symbol
+// availability, which is the thing that actually breaks at load time. See issue #515.
+const MACOS_DEPLOYMENT_TARGET = "12.0";
+
const VERSION = "8.1.2";
const TARBALL_SHA256 = "464beb5e7bf0c311e68b45ae2f04e9cc2af88851abb4082231742a74d97b524c";
const DEST = path.join(CRATES_DIR, "thirdparty", `ffmpeg-n${VERSION}-macos64-lgpl-shared`);
@@ -202,6 +214,10 @@ run(
"--disable-x86asm",
`--arch=${process.arch === "arm64" ? "arm64" : "x86_64"}`,
"--cc=clang",
+ // Both, not just cflags: the deployment target has to reach the link step too, or
+ // the dylibs are stamped with the build machine's floor however they were compiled.
+ `--extra-cflags=-mmacosx-version-min=${MACOS_DEPLOYMENT_TARGET}`,
+ `--extra-ldflags=-mmacosx-version-min=${MACOS_DEPLOYMENT_TARGET}`,
],
{ cwd: src },
);