fix(fish-speech): allow invalid_reference_casting so tokenizers builds on darwin#10573
Merged
Merged
Conversation
…s on darwin
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 <mudler@localai.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure
In the v4.5.5 release CI, the
fish-speechbackend image build job FAILED on darwin/metal arm64 (mps profile). All Linux variants (cpu/cublas/etc) built fine.The failure happens during the editable install of fish-speech source (
pip install --no-build-isolation -e ...inbackend/python/fish-speech/install.sh):Root cause
On darwin arm64 the transitive
tokenizersPython package compiles its Rust extension from source, because there is no prebuilt manylinux wheel for that platform. (On Linux the prebuilt wheel is used, so the Rust code never compiles there - which is why only the darwin job broke.)The pinned
tokenizerscrate that fish-speech's dependency stack resolves to contains a&T->&mut Tcast. That pattern is flagged by theinvalid_reference_castinglint, which is deny-by-default in the macOS CI runner's newer Rust toolchain. It compiled under the older toolchain but is now rejected.Fix
Export
RUSTFLAGSwith-A invalid_reference_castingbeforeinstallRequirementsinbackend/python/fish-speech/install.sh, so the unchanged third-party crate compiles as it did before the toolchain bump. The flag is appended to any existingRUSTFLAGSrather than clobbering it.This is version-agnostic (no risky dependency repin) and harmless on Linux, where no Rust compile happens.