Skip to content

recipe: scipy 1.18.0 + flet-libopenblas 0.3.33#90

Merged
ndonkoHenri merged 5 commits into
mainfrom
scipy
Jul 1, 2026
Merged

recipe: scipy 1.18.0 + flet-libopenblas 0.3.33#90
ndonkoHenri merged 5 commits into
mainfrom
scipy

Conversation

@ndonkoHenri

Copy link
Copy Markdown

Adds scipy (flet-dev/flet#3391) and its BLAS/LAPACK backend flet-libopenblas.

Approach

  • Fortran-free: scipy 1.18 builds with -D_without-fortran=true; the only casualty is the deprecated scipy.odr. This removes the cross-Fortran toolchain blocker entirely — scipy then needs only a BLAS/LAPACK backend.
  • OpenBLAS everywhere: A new flet-libopenblas recipe builds OpenBLAS with NOFORTRAN=1 (BLAS + the f2c-converted LAPACK, no Fortran compiler) as a static lib, and scipy links it via -Dblas=openblas -Dlapack=openblas on both platforms. This is scipy's most-tested BLAS path (standard sgemm_ mangling), unifies iOS and Android, and sidesteps Apple Accelerate's macOS-centric gaps on iOS. scipy-openblas32 isn't an option (no iOS/Android wheels).

Recipes

  • flet-libopenblas 0.3.33build.sh cross-compiles OpenBLAS per arch (ARMV8 / NEHALEM / ARMV7), static-only, and rewrites openblas.pc to be relocatable (and drops its baked-in -lgfortran/-lpthread). Statically linked into scipy, so it is a build-time host dep only (not in scipy's Requires-Dist).
  • scipy 1.18.0 — meson-python recipe; host deps numpy 2.4.6, pybind11, flet-libopenblas, and flet-libcpp-shared (Android C++ runtime).

Platform notes

iOS builds with no patches. Android needs four small, platform-guarded fixes for bionic/NDK gaps (each a no-op on iOS):

  • -Duse-pythran=false — pythran 0.18's ndarray.hpp has a ref-qualifier overload the newer NDK clang rejects (affected modules fall back to their Cython versions).
  • android-bionic-clog-cpow.patch — bionic only declares the C99 clog/cpow from API 26; shim them for __ANDROID_API__ < 26 via functions present at API 24.
  • android-ducc-no-affinity.patch — scipy.fft's vendored ducc pins threads with the glibc-only pthread_{get,set}affinity_np; fall back to its no-affinity path on Android (CPU pinning is only an optimization).
  • android-x86_64-boost-longdouble.patch — Android x86_64 uses 128-bit IEEE-quad long double (LDBL_MANT_DIG==113), not x86's 80-bit; gate boost.math's x86 branch on ==64 so it falls through to boost's existing binary128 path.

Forge fix

src/forge/build.py: the site-packages pkg-config glob only matched */share/pkgconfig, missing numpy's numpy/_core/lib/pkgconfig/numpy.pc, so scipy 1.18's dependency('numpy') couldn't find it. Added */lib/pkgconfig and */_core/lib/pkgconfig — a general win for any dependency('numpy') consumer.

Validation

  • Builds green across the full matrix: iOS (iphoneos.arm64, iphonesimulator.arm64, iphonesimulator.x86_64) and Android (arm64-v8a, x86_64, armeabi-v7a).
  • CI: build + mobile tests green on Android and iOS for 3.12.
  • On-device verified (iOS simulator + Android arm64 emulator): import scipy, scipy.linalg.solve/svd (OpenBLAS LAPACK), scipy.fft (ducc), and scipy.special.gamma(0.5)==√π all correct.

scipy via OpenBLAS everywhere (NOFORTRAN f2c-LAPACK) + -D_without-fortran.
iOS: no patches. Android: 3 patches (clog/cpow shim, ducc no-affinity,
boost binary128 long double on x86_64) + use-pythran=false. flet-libopenblas
builds BLAS+LAPACK static, openblas.pc relocatable.

NOTE: android still needs the libpython.so symlink fix (not yet in repo) -
expected to fail at the scipy link step on CI until that lands.
@ndonkoHenri ndonkoHenri merged commit d7cdd2c into main Jul 1, 2026
8 of 16 checks passed
@ndonkoHenri ndonkoHenri deleted the scipy branch July 1, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant