From 9acf6b759b142fbc96b4b62b926a6f7f9526e18c Mon Sep 17 00:00:00 2001 From: Seyed Yahya Shirazi Date: Fri, 17 Jul 2026 14:50:29 -0700 Subject: [PATCH] Fix cross-platform release build (Linux libblas, MSYS2 python/cc) --- .github/workflows/release-binaries.yml | 8 +++++--- native/build.sh | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml index 5b0dffd..9d6516b 100644 --- a/.github/workflows/release-binaries.yml +++ b/.github/workflows/release-binaries.yml @@ -72,10 +72,12 @@ jobs: update: true # OpenBLAS provides both BLAS and LAPACK. The package prefix differs by # environment (mingw-w64-x86_64-* vs mingw-w64-clang-aarch64-*). + # gcc-fortran (gfortran + gcc/cc), openblas (BLAS+LAPACK), python (for + # patch_sources.py). Package prefix differs by environment. install: >- ${{ matrix.msystem == 'CLANGARM64' - && 'mingw-w64-clang-aarch64-gcc-fortran mingw-w64-clang-aarch64-openblas' - || 'mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-openblas' }} + && 'mingw-w64-clang-aarch64-gcc-fortran mingw-w64-clang-aarch64-openblas mingw-w64-clang-aarch64-python' + || 'mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-openblas mingw-w64-x86_64-python' }} # --- Build ----------------------------------------------------------- - name: Build native binary @@ -90,7 +92,7 @@ jobs: ;; linux-*) # Static LAPACK/BLAS + Fortran runtime; glibc stays dynamic. - export LAPACK_LIBS="-l:liblapack.a -l:lblas.a" + export LAPACK_LIBS="-l:liblapack.a -l:libblas.a" export EXTRA_LDFLAGS="-static-libquadmath" ;; windows-*) diff --git a/native/build.sh b/native/build.sh index 3d4a539..67df4e1 100755 --- a/native/build.sh +++ b/native/build.sh @@ -20,7 +20,10 @@ mode="${MPI_MODE:-shim}" build_dir="$here/build_$mode" out="${OUT:-$here/amica15_$mode}" os="$(uname -s)" -cc="${CC:-cc}" +# `cc` is not always present (MSYS2 mingw ships `gcc`, not `cc`); fall back. +cc="${CC:-$(command -v cc 2>/dev/null || command -v gcc 2>/dev/null || echo cc)}" +# patch_sources.py needs a Python; MSYS2 mingw calls it `python`, not `python3`. +python="${PYTHON:-$(command -v python3 2>/dev/null || command -v python 2>/dev/null || echo python3)}" if [[ "$mode" == "shim" ]]; then fc="${FC:-gfortran}" @@ -53,7 +56,7 @@ work="$build_dir/src" cp "$src_dir/funmod2.f90" "$src_dir/amica15.f90" "$src_dir/amica15_header.f90" "$work/" # --- Patch the build copy only (the tracked sources stay the parity reference). -python3 "$here/patch_sources.py" "$work/amica15.f90" "$work/amica15_header.f90" +"$python" "$here/patch_sources.py" "$work/amica15.f90" "$work/amica15_header.f90" set -x # Vector-math shim (vrda_exp/vrda_log as libm loops); portable, no AMD LibM.