From 3d2f639213cf3140772aae08086ee95ef8648e78 Mon Sep 17 00:00:00 2001 From: "LocalAI [bot]" <139863280+localai-bot@users.noreply.github.com> Date: Sun, 28 Jun 2026 19:10:27 +0200 Subject: [PATCH] fix(fish-speech): allow invalid_reference_casting so tokenizers builds on darwin (#10573) On darwin arm64 the fish-speech editable install (pip install --no-build-isolation -e) compiles the transitive `tokenizers` Python package's Rust extension from source, because there is no prebuilt manylinux wheel for that platform (Linux builds never compile it, so this only breaks on macOS). The pinned tokenizers crate fish-speech's stack resolves to contains a `&T` -> `&mut T` cast that the macOS CI runner's newer Rust toolchain rejects via the now-deny-by-default `invalid_reference_casting` lint: error: casting `&T` to `&mut T` is undefined behavior ... error: could not compile `tokenizers` (lib) due to 1 previous error ERROR: Failed building wheel for tokenizers This failed the fish-speech darwin/metal (mps) backend image build in the v4.5.5 release CI while all Linux variants built fine. Fix: export RUSTFLAGS with `-A invalid_reference_casting` (appended to any existing value, not clobbering) before installRequirements so the unchanged third-party crate compiles as it did under the older toolchain. Version-agnostic and harmless on Linux, where no Rust compile happens. Assisted-by: Claude:claude-opus-4-8 [Claude Code] Signed-off-by: Ettore Di Giacinto Co-authored-by: Ettore Di Giacinto --- backend/python/fish-speech/install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/python/fish-speech/install.sh b/backend/python/fish-speech/install.sh index 6e1ab8c95..4be2cd2d2 100644 --- a/backend/python/fish-speech/install.sh +++ b/backend/python/fish-speech/install.sh @@ -13,6 +13,17 @@ fi # fish-speech uses pyrootutils which requires a .project-root marker touch "${backend_dir}/.project-root" +# On darwin arm64 the transitive `tokenizers` dep compiles its Rust extension +# from source (Linux uses prebuilt manylinux wheels, so it never compiles +# there). The pinned tokenizers crate that fish-speech's stack resolves to +# contains a `&T` -> `&mut T` cast that trips the now-deny-by-default +# `invalid_reference_casting` lint in the macOS runner's newer Rust toolchain, +# breaking the build (seen in the v4.5.5 release CI fish-speech darwin/metal +# job). Allow that lint so the unchanged third-party crate compiles as before. +# Append rather than clobber any pre-existing RUSTFLAGS; harmless on Linux +# where no Rust compile happens. +export RUSTFLAGS="${RUSTFLAGS:-} -A invalid_reference_casting" + installRequirements # Clone fish-speech source (the pip package doesn't include inference modules)