From 28bf712ecb8065067d6f7cd4bfe9f14d4418e51e Mon Sep 17 00:00:00 2001 From: Luis Lobo Borobia <453120+luislobo@users.noreply.github.com> Date: Tue, 1 Sep 2026 16:20:19 -0500 Subject: [PATCH] build(linux): default ggml CPU features to a portable build whisper.cpp (via whisper-rs-sys) compiles its CPU backend during `tauri build`, and ggml tunes for the build host by default. For a distributable bundle that is wrong twice over: a host-tuned artifact can SIGILL on an older user CPU, and the feature probe trusts each flag independently. The second one is not theoretical. A clean Ubuntu 24.04 VM advertised `avx2` but not `fma`; ggml enabled its AVX2 path regardless and the build failed on an FMA intrinsic: error: inlining failed in call to 'always_inline' '_mm256_fmadd_ps': target specific option mismatch Default the GGML_* feature flags OFF so the shipped binary runs anywhere, while leaving every one of them overridable from the environment for builders who want a host-optimised local package. This matters most for the CI job this PR adds: a runner whose CPU flags differ from the target host would otherwise produce artifacts that fail on user machines, or fail to build at all. Co-Authored-By: Claude Opus 5 (1M context) --- packaging/build_linux.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packaging/build_linux.sh b/packaging/build_linux.sh index 5a4cdaccca..61171586a2 100755 --- a/packaging/build_linux.sh +++ b/packaging/build_linux.sh @@ -67,6 +67,27 @@ rm -rf "$GUI/src-tauri/binaries/sidecar" "$GUI/src-tauri/binaries/openworker-ser cp -RL "$HERE/dist/openworker-server" "$GUI/src-tauri/binaries/sidecar" chmod +x "$GUI/src-tauri/binaries/sidecar/openworker-server" +# whisper.cpp (via whisper-rs-sys) compiles its CPU backend during the Rust build below, and +# ggml's default is to tune for the *build host*. That is wrong for a distributable bundle in two +# ways. First, a host-tuned artifact can die with SIGILL on an older user CPU. Second, the feature +# probe trusts flags independently: a clean Ubuntu 24.04 VM here advertised `avx2` but not `fma`, +# ggml enabled its AVX2 path anyway, and the build failed outright on an FMA intrinsic: +# error: inlining failed in call to 'always_inline' '_mm256_fmadd_ps': target specific option mismatch +# Default every feature OFF so the shipped binary runs anywhere; builders who want a host-optimised +# local package can still override any of these from the environment. +export GGML_NATIVE="${GGML_NATIVE:-OFF}" +export GGML_AVX="${GGML_AVX:-OFF}" +export GGML_AVX2="${GGML_AVX2:-OFF}" +export GGML_AVX_VNNI="${GGML_AVX_VNNI:-OFF}" +export GGML_AVX512="${GGML_AVX512:-OFF}" +export GGML_AVX512_VBMI="${GGML_AVX512_VBMI:-OFF}" +export GGML_AVX512_VNNI="${GGML_AVX512_VNNI:-OFF}" +export GGML_AVX512_BF16="${GGML_AVX512_BF16:-OFF}" +export GGML_BMI2="${GGML_BMI2:-OFF}" +export GGML_F16C="${GGML_F16C:-OFF}" +export GGML_FMA="${GGML_FMA:-OFF}" +export GGML_SSE42="${GGML_SSE42:-OFF}" + echo "==> [3/3] tauri build (--bundles $BUNDLES)" # Auto-update artifacts (.deb/.AppImage + minisign .sig): produced only when the updater # signing key is available — from the env (CI secret TAURI_SIGNING_PRIVATE_KEY), or from