sentencepiece: set SPM_ENABLE_SHARED=OFF on darwin

This fixes segmentation faults on importing sentencepiece module, and it
reflects how wheels for Darwin are built by upstream too.

Fixes #466092
This commit is contained in:
Ihar Hrachyshka
2025-12-13 21:20:50 -05:00
parent ca5a44d3a4
commit 563ed2d28f
@@ -36,6 +36,12 @@ stdenv.mkDerivation rec {
--replace '\$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR}
'';
# On Darwin, non-static build segfaults on python module import.
# See: https://github.com/NixOS/nixpkgs/issues/466092
cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
"-DSPM_ENABLE_SHARED=OFF"
];
meta = {
homepage = "https://github.com/google/sentencepiece";
description = "Unsupervised text tokenizer for Neural Network-based text generation";