From ac15bb276c49781d82a689528d2925c82183f8e4 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 18 Nov 2026 09:38:52 +0200 Subject: [PATCH 01/14] drop win-x86, use rtools4.5 --- .github/workflows/windows.yml | 30 ++++++++---------------------- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 18b0eb89..6775067b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -22,18 +22,16 @@ env: # Preserve working directory for calls into bash # Without this, invoking bash will cd to the home directory CHERE_INVOKING: "yes" - BASH_PATH: "c:\\rtools40\\usr\\bin\\bash.exe" + BASH_PATH: "c:\\rtools45\\usr\\bin\\bash.exe" jobs: build: strategy: matrix: - plat: ['x64', 'x86'] + plat: ['x64'] INTERFACE64: ['1', '0'] os: [windows-latest] exclude: - - plat: x86 - INTERFACE64: '1' fail-fast: false runs-on: ${{ matrix.os }} @@ -48,28 +46,16 @@ jobs: - uses: actions/checkout@v6.0.1 - name: install-rtools run: | - # rtools 42+ does not support 32 bits builds. - choco install -y rtools --no-progress --force --version=4.0.0.20220206 + choco install -y rtools --no-progress --force --version=4.5.6768 - name: Set env variables run: | echo "START_DIR=$PWD" >> $env:GITHUB_ENV - # For interpretation of MSYSTEM, see: - # https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939 - if ( "${{ matrix.plat }}" -eq "x86") { - echo "PLAT=i686" >> $env:GITHUB_ENV - echo "WHEEL_PLAT=win32" >> $env:GITHUB_ENV - echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV - # No ucrt on 32-bits, so use _snprintf_c instead - echo "LDFLAGS=-static -static-libgcc -Wl,--defsym,_quadmath_snprintf=__snprintf_c" >> $env:GITHUB_ENV - echo "BUILD_BITS=32" >> $env:GITHUB_ENV - } else { - echo "PLAT=x86_64" >> $env:GITHUB_ENV - echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV - echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV - echo "LDFLAGS=-lucrt -static -static-libgcc -Wl,--defsym,quadmath_snprintf=snprintf" >> $env:GITHUB_ENV - echo "BUILD_BITS=64" >> $env:GITHUB_ENV - } + echo "PLAT=x86_64" >> $env:GITHUB_ENV + echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV + echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV + echo "LDFLAGS=-lucrt -static -static-libgcc -Wl,--defsym,quadmath_snprintf=snprintf" >> $env:GITHUB_ENV + echo "BUILD_BITS=64" >> $env:GITHUB_ENV if ( ${{ matrix.INTERFACE64 }} -eq "1" ) { echo "INTERFACE64=1" >> $env:GITHUB_ENV } diff --git a/CHANGELOG.md b/CHANGELOG.md index 019d8b61..45df8ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## OpenBLAS v0.3.34 (v0.3.34) +### 0.3.34.481.4 (2026-11-19) + +- Drop 32-bit windows wheels, update rtools + ### 0.3.34.481.3 (2026-11-2) - Refactor gha upload to anaconda.org diff --git a/pyproject.toml b/pyproject.toml index f03f77a9..1a9b3199 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta" [project] name = "scipy-openblas64" # 0.3.34-481-g5137bb62 -version = "0.3.34.481.3" +version = "0.3.34.481.4" requires-python = ">=3.7" description = "Provides OpenBLAS for python packaging" readme = "README.md" From 42747bdbfb984f23509d4c982003a287abdc2208 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 18 Nov 2026 12:16:08 +0200 Subject: [PATCH 02/14] typo --- .github/workflows/windows.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6775067b..2fb57442 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -31,7 +31,6 @@ jobs: plat: ['x64'] INTERFACE64: ['1', '0'] os: [windows-latest] - exclude: fail-fast: false runs-on: ${{ matrix.os }} From 8831fd18b18225e184699bb3767104de93ec658e Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 18 Nov 2026 12:30:43 +0200 Subject: [PATCH 03/14] use older runner for docker builds --- .github/workflows/posix.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/posix.yml b/.github/workflows/posix.yml index 12182965..e47f15ef 100644 --- a/.github/workflows/posix.yml +++ b/.github/workflows/posix.yml @@ -29,7 +29,7 @@ jobs: fail-fast: false matrix: include: - - { os: ubuntu-latest, PLAT: i686, INTERFACE64: '0', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} + - { os: ubuntu-24.04, PLAT: i686, INTERFACE64: '0', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '1', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} @@ -58,8 +58,8 @@ jobs: - { os: ubuntu-24.04-arm, PLAT: riscv64, INTERFACE64: '0', MB_ML_VER: '_2_39', MB_ML_LIBC: manylinux} - { os: ubuntu-24.04-arm, PLAT: riscv64, INTERFACE64: '1', MB_ML_VER: '_2_39', MB_ML_LIBC: manylinux} - - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_LIBC: android} - - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '1', MB_ML_LIBC: android} + - { os: ubuntu-24.04, PLAT: x86_64, INTERFACE64: '0', MB_ML_LIBC: android} + - { os: ubuntu-24.04, PLAT: x86_64, INTERFACE64: '1', MB_ML_LIBC: android} - { os: ubuntu-latest, PLAT: arm64_v8a, INTERFACE64: '0', MB_ML_LIBC: android} - { os: ubuntu-latest, PLAT: arm64_v8a, INTERFACE64: '1', MB_ML_LIBC: android} From 9f6299c28c3ae46ad18a47463d4b520a27fb2899 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 18 Nov 2026 13:25:54 +0200 Subject: [PATCH 04/14] rtools is already installed --- .github/workflows/posix.yml | 1 + .github/workflows/windows.yml | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/posix.yml b/.github/workflows/posix.yml index e47f15ef..d6475e16 100644 --- a/.github/workflows/posix.yml +++ b/.github/workflows/posix.yml @@ -29,6 +29,7 @@ jobs: fail-fast: false matrix: include: + # Pin docker builds to ubuntu-24.04 https://github.com/actions/runner-images/issues/14790 - { os: ubuntu-24.04, PLAT: i686, INTERFACE64: '0', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2fb57442..ff87eeab 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -43,9 +43,10 @@ jobs: timeout-minutes: 90 steps: - uses: actions/checkout@v6.0.1 - - name: install-rtools - run: | - choco install -y rtools --no-progress --force --version=4.5.6768 + # Already installed + # - name: install-rtools + # run: | + # choco install -y rtools --no-progress --force --version=4.5.6768 - name: Set env variables run: | From 3946c93a22b2ee664721db4db52daa044d7d3983 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 18 Nov 2026 22:57:58 +0200 Subject: [PATCH 05/14] build win-x86_64 together with win-arm64 --- .github/workflows/windows-arm.yml | 54 +++++++--- ...teps_win_arm64.bat => build_steps_win.bat} | 98 ++++++++++++++----- 2 files changed, 111 insertions(+), 41 deletions(-) rename tools/{build_steps_win_arm64.bat => build_steps_win.bat} (80%) diff --git a/.github/workflows/windows-arm.yml b/.github/workflows/windows-arm.yml index d6472edd..68b7b379 100644 --- a/.github/workflows/windows-arm.yml +++ b/.github/workflows/windows-arm.yml @@ -1,4 +1,4 @@ -name: Windows-on-ARM +name: Windows on: push: @@ -24,18 +24,29 @@ env: # Without this, invoking bash will cd to the home directory CHERE_INVOKING: "yes" BASH_PATH: "C:\\Program Files\\Git\\bin\\bash.exe" - PLAT: arm64 + LLVM_VERSION: "20.1.8" + NINJA_VERSION: "1.13.1" jobs: build: - runs-on: windows-11-arm + runs-on: ${{ matrix.os }} timeout-minutes: 90 strategy: + fail-fast: false matrix: - INTERFACE64: ['1', '0'] + # Both architectures build with the same toolchain (clang-cl + + # flang-new + cmake + ninja) and the same script, so they differ only + # in the runner, the installer assets and the wheel tag. + include: + - { os: windows-latest, PLAT: x86_64, WHEEL_PLAT: win_amd64, PY_ARCH: x64, LLVM_ASSET: win64, NINJA_ASSET: win, INTERFACE64: '0' } + - { os: windows-latest, PLAT: x86_64, WHEEL_PLAT: win_amd64, PY_ARCH: x64, LLVM_ASSET: win64, NINJA_ASSET: win, INTERFACE64: '1' } + - { os: windows-11-arm, PLAT: arm64, WHEEL_PLAT: win_arm64, PY_ARCH: arm64, LLVM_ASSET: woa64, NINJA_ASSET: winarm64, INTERFACE64: '0' } + - { os: windows-11-arm, PLAT: arm64, WHEEL_PLAT: win_arm64, PY_ARCH: arm64, LLVM_ASSET: woa64, NINJA_ASSET: winarm64, INTERFACE64: '1' } env: + PLAT: ${{ matrix.PLAT }} + WHEEL_PLAT: ${{ matrix.WHEEL_PLAT }} INTERFACE64: ${{ matrix.INTERFACE64 }} # A scheduled or manually triggered run builds against the latest # OpenBLAS HEAD instead of openblas_commit.txt @@ -50,28 +61,39 @@ jobs: uses: actions/setup-python@v6.2.0 with: python-version: 3.12 - architecture: arm64 + architecture: ${{ matrix.PY_ARCH }} - name: Download and install LLVM installer + # The runner images' preinstalled LLVM has no flang; the official + # installer does. run: | - Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -UseBasicParsing -OutFile LLVM-woa64.exe - Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait + $url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${env:LLVM_VERSION}/LLVM-${env:LLVM_VERSION}-${{ matrix.LLVM_ASSET }}.exe" + echo "Downloading $url" + Invoke-WebRequest $url -UseBasicParsing -OutFile LLVM-installer.exe + Start-Process -FilePath ".\LLVM-installer.exe" -ArgumentList "/S" -Wait echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Install CMake and Ninja for Win-ARM64 + - name: Install Ninja + shell: pwsh + run: | + $url = "https://github.com/ninja-build/ninja/releases/download/v${env:NINJA_VERSION}/ninja-${{ matrix.NINJA_ASSET }}.zip" + echo "Downloading $url" + Invoke-WebRequest $url -OutFile ninja.zip + Expand-Archive ninja.zip -DestinationPath ninja + Copy-Item ninja\ninja.exe -Destination "C:\Windows\System32" + + - name: Install CMake for Win-ARM64 + # windows-latest already ships a usable cmake; the ARM64 image does not. + if: matrix.PLAT == 'arm64' shell: pwsh run: | Invoke-WebRequest https://github.com/Kitware/CMake/releases/download/v3.29.4/cmake-3.29.4-windows-arm64.msi -OutFile cmake-arm64.msi Start-Process msiexec.exe -ArgumentList "/i cmake-arm64.msi /quiet /norestart" -Wait echo "C:\Program Files\CMake\bin" >> $env:GITHUB_PATH - Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-winarm64.zip -OutFile ninja-winarm64.zip - Expand-Archive ninja-winarm64.zip -DestinationPath ninja - Copy-Item ninja\ninja.exe -Destination "C:\Windows\System32" - - name: Set env variables run: | - if ( ${{ matrix.INTERFACE64 }} -eq "1" ) { + if ( "${{ matrix.INTERFACE64 }}" -eq "1" ) { echo "INTERFACE_BITS=64" >> $env:GITHUB_ENV } else { echo "INTERFACE_BITS=32" >> $env:GITHUB_ENV @@ -80,9 +102,9 @@ jobs: - name: Build run: | git submodule update --init --recursive - .\tools\build_steps_win_arm64.bat 64 ${env:INTERFACE_BITS} + .\tools\build_steps_win.bat 64 ${env:INTERFACE_BITS} - - name: Test ${{ matrix.INTERFACE_BITS }}-bit interface wheel + - name: Test wheel, INTERFACE64=${{ matrix.INTERFACE64 }} run: | python -m pip install --no-index --find-links dist scipy_openblas${env:INTERFACE_BITS} python -m scipy_openblas${env:INTERFACE_BITS} @@ -90,7 +112,7 @@ jobs: - uses: actions/upload-artifact@v6.0.0 with: - name: wheels-${{ env.PLAT }}-${{ env.INTERFACE64 }} + name: wheels-${{ matrix.PLAT }}-${{ matrix.INTERFACE64 }} path: dist/scipy_openblas*.whl upload: diff --git a/tools/build_steps_win_arm64.bat b/tools/build_steps_win.bat similarity index 80% rename from tools/build_steps_win_arm64.bat rename to tools/build_steps_win.bat index 6446b3ca..fe9ae02c 100755 --- a/tools/build_steps_win_arm64.bat +++ b/tools/build_steps_win.bat @@ -1,17 +1,17 @@ -REM Build script for scipy_openblas wheel on Windows on ARM64 +REM Build script for scipy_openblas wheels on Windows, x86_64 and ARM64 alike. -REM Usage: build_steps_win_arm64.bat [build_bits] [if_bits] -REM e.g build_steps_win_arm64.bat 64 64 +REM Usage: build_steps_win.bat [build_bits] [if_bits] +REM e.g build_steps_win.bat 64 64 REM build_bits (default binary architecture, 32 or 64, unspec -> 64). REM if_bits (default interface size, 32 or 64, unspec -> 32) REM If INTERFACE64 environment variable is 1, then if_bits defaults to 64 +REM PLAT (target architecture, x86_64 or arm64; unspec -> derived from +REM PROCESSOR_ARCHITECTURE) +REM WHEEL_PLAT (wheel platform tag, win_amd64 or win_arm64; unspec -> +REM derived from PLAT) REM Expects these binaries on the PATH: REM clang-cl, flang-new, cmake, perl -REM First commit containing WoA build fixes. -REM Minimum OpenBLAS commit to build; we'll update to this if commit not -REM present. -set first_woa_buildable_commit="de2380e5a6149706a633322a16a0f66faa5591fc" @echo off setlocal enabledelayedexpansion @@ -31,8 +31,29 @@ if "%2"=="" ( ) else ( set "if_bits=%2" ) -echo Building for %build_bits%-bit binary, %if_bits%-bit interface... - +REM Resolve the target architecture. The workflow passes PLAT and WHEEL_PLAT, +REM but derive them when running locally so the script is usable by hand. +if "%PLAT%"=="" ( + if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( + set "PLAT=arm64" + ) else ( + set "PLAT=x86_64" + ) +) +if "%WHEEL_PLAT%"=="" ( + if "%PLAT%"=="arm64" ( + set "WHEEL_PLAT=win_arm64" + ) else ( + set "WHEEL_PLAT=win_amd64" + ) +) +if "%PLAT%"=="arm64" ( + set "vcvars_arch=arm64" +) else ( + set "vcvars_arch=x64" +) +echo Building %PLAT% for %build_bits%-bit binary, %if_bits%-bit interface, wheel tag %WHEEL_PLAT%... + REM Define destination directory pushd "%~dp0\.." set "ob_out_root=%CD%\local\scipy_openblas" @@ -70,13 +91,7 @@ if "%NIGHTLY%"=="true" ( git checkout %OPENBLAS_COMMIT% ) if errorlevel 1 exit /b 1 -git merge-base --is-ancestor %first_woa_buildable_commit% HEAD 2>NUL -if errorlevel 1 ( - echo OpenBLAS commit does not contain WoA build fixes. - echo Commit needs to contain %first_woa_buildable_commit%. - exit /b 2 -) - + REM Patch set patch_rc=0 for %%f in (..\patches-common\*.patch ..\patches\*.patch ..\patches-windows\*.patch) do ( @@ -113,9 +128,9 @@ REM Create build directory and navigate to it if exist build (rmdir /S /Q build || exit /b 1) mkdir build || exit /b 1 & cd build || exit /b 1 -echo Setting up ARM64 Developer Command Prompt and running CMake... +echo Setting up %vcvars_arch% Developer Command Prompt and running CMake... -REM Initialize VS ARM64 environment. +REM Initialize the VS environment for the target architecture. REM REM Ask vswhere where Visual Studio is rather than hardcoding the version and REM edition: the windows-11-arm image migrated from VS 2022 to VS 2026 in @@ -144,9 +159,9 @@ if not exist "%VCVARSALL%" ( exit /b 1 ) echo Using Visual Studio at "%VSINSTALL%" -CALL "%VCVARSALL%" arm64 +CALL "%VCVARSALL%" %vcvars_arch% if errorlevel 1 ( - echo Error: "%VCVARSALL%" arm64 failed. + echo Error: "%VCVARSALL%" %vcvars_arch% failed. exit /b 1 ) where mt.exe >NUL 2>&1 @@ -159,22 +174,47 @@ if errorlevel 1 ( REM Prefer LLVM flang PATH=C:\Program Files\LLVM\bin;%PATH% +REM Visual Studio ships its own LLVM with an incomplete flang, so confirm +REM which compilers we actually resolved to. +where clang-cl +if errorlevel 1 ( + echo Error: clang-cl is not on PATH. + exit /b 1 +) +where flang-new +if errorlevel 1 ( + echo Error: flang-new is not on PATH. + exit /b 1 +) +clang-cl --version +flang-new --version + REM Run CMake and Ninja build +if "%PLAT%"=="arm64" ( + set "arch_flags=-DTARGET=ARMV8 -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_SYSTEM_NAME=Windows" +) else ( + set "arch_flags=-DTARGET=PRESCOTT -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST=NEHALEM;SANDYBRIDGE;HASWELL;SKYLAKEX" +) + set CFLAGS=-Wno-reserved-macro-identifier -Wno-unsafe-buffer-usage -Wno-unused-macros -Wno-sign-conversion -Wno-reserved-identifier cmake .. -G Ninja ^ -DCMAKE_BUILD_TYPE=Release ^ - -DTARGET=ARMV8 ^ -DBINARY=%build_bits% ^ -DCMAKE_C_COMPILER=clang-cl ^ -DCMAKE_Fortran_COMPILER=flang-new ^ -DBUILD_SHARED_LIBS=ON ^ - -DCMAKE_SYSTEM_PROCESSOR=arm64 ^ - -DCMAKE_SYSTEM_NAME=Windows ^ -DSYMBOLPREFIX="scipy_" ^ -DLIBNAMEPREFIX="scipy_" ^ - -DUSE_THREADS=1 ^ + -DUSE_THREAD=1 ^ + -DUSE_OPENMP=0 ^ -DNUM_THREADS=24 ^ + -DNO_WARMUP=1 ^ + -DCONSISTENT_FPCSR=1 ^ + -DBUILD_LAPACK_DEPRECATED=ON ^ + -DFIXED_LIBNAME=1 ^ + -DBUFFERSIZE=20 ^ + %arch_flags% ^ %interface_flags% if errorlevel 1 exit /b 1 @@ -248,6 +288,14 @@ if errorlevel 1 ( exit /b 1 ) +REM Append the bundled-software notices to LICENSE.txt, as the posix build and +REM the old mingw Windows build both do. +(echo.)>> LICENSE.txt +(echo ----)>> LICENSE.txt +(echo.)>> LICENSE.txt +type tools\LICENSE_win32.txt >> LICENSE.txt +if errorlevel 1 exit /b 1 + REM Build the Wheel & Install It echo Running 'python -m build' to build the wheel in %CD% python -c "import build" 2>NUL || pip install build @@ -269,7 +317,7 @@ REM Rename the wheel for %%f in (dist\*any.whl) do ( set WHEEL_FILE=dist\%%f set "filename=%%~nxf" - set "newname=!filename:any.whl=win_arm64.whl!" + set "newname=!filename:any.whl=%WHEEL_PLAT%.whl!" ren "dist\!filename!" "!newname!" ) From 3e24077e2269806bc1511c04ebbe7ec8365466de Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 18 Nov 2026 23:34:37 +0200 Subject: [PATCH 06/14] use llvm 22.1.8 since it has flang for both architectures --- .github/workflows/windows-arm.yml | 3 ++- tools/build_steps_win.bat | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/windows-arm.yml b/.github/workflows/windows-arm.yml index 68b7b379..bce9ad0d 100644 --- a/.github/workflows/windows-arm.yml +++ b/.github/workflows/windows-arm.yml @@ -24,11 +24,12 @@ env: # Without this, invoking bash will cd to the home directory CHERE_INVOKING: "yes" BASH_PATH: "C:\\Program Files\\Git\\bin\\bash.exe" - LLVM_VERSION: "20.1.8" + LLVM_VERSION: "22.1.8" NINJA_VERSION: "1.13.1" jobs: build: + name: ${{ matrix.PLAT }}_${{ matrix.INTERFACE64 }} runs-on: ${{ matrix.os }} timeout-minutes: 90 diff --git a/tools/build_steps_win.bat b/tools/build_steps_win.bat index fe9ae02c..a95a1924 100755 --- a/tools/build_steps_win.bat +++ b/tools/build_steps_win.bat @@ -11,7 +11,7 @@ REM PROCESSOR_ARCHITECTURE) REM WHEEL_PLAT (wheel platform tag, win_amd64 or win_arm64; unspec -> REM derived from PLAT) REM Expects these binaries on the PATH: -REM clang-cl, flang-new, cmake, perl +REM clang-cl, flang, cmake, perl @echo off setlocal enabledelayedexpansion @@ -181,20 +181,23 @@ if errorlevel 1 ( echo Error: clang-cl is not on PATH. exit /b 1 ) -where flang-new +where flang if errorlevel 1 ( - echo Error: flang-new is not on PATH. + echo Error: flang is not on PATH. exit /b 1 ) clang-cl --version -flang-new --version +flang --version REM Run CMake and Ninja build +REM CONSISTENT_FPCSR is x86-only: it makes blas_server_win32.c save and restore +REM the FPU/SSE control words with ldmxcsr/fldcw/fnstcw/stmxcsr inline asm, +REM which clang-cl rejects on arm64 ("unrecognized instruction mnemonic"). if "%PLAT%"=="arm64" ( set "arch_flags=-DTARGET=ARMV8 -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_SYSTEM_NAME=Windows" ) else ( - set "arch_flags=-DTARGET=PRESCOTT -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST=NEHALEM;SANDYBRIDGE;HASWELL;SKYLAKEX" + set "arch_flags=-DTARGET=PRESCOTT -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST=NEHALEM;SANDYBRIDGE;HASWELL;SKYLAKEX -DCONSISTENT_FPCSR=1" ) set CFLAGS=-Wno-reserved-macro-identifier -Wno-unsafe-buffer-usage -Wno-unused-macros -Wno-sign-conversion -Wno-reserved-identifier @@ -202,7 +205,7 @@ cmake .. -G Ninja ^ -DCMAKE_BUILD_TYPE=Release ^ -DBINARY=%build_bits% ^ -DCMAKE_C_COMPILER=clang-cl ^ - -DCMAKE_Fortran_COMPILER=flang-new ^ + -DCMAKE_Fortran_COMPILER=flang ^ -DBUILD_SHARED_LIBS=ON ^ -DSYMBOLPREFIX="scipy_" ^ -DLIBNAMEPREFIX="scipy_" ^ @@ -210,7 +213,6 @@ cmake .. -G Ninja ^ -DUSE_OPENMP=0 ^ -DNUM_THREADS=24 ^ -DNO_WARMUP=1 ^ - -DCONSISTENT_FPCSR=1 ^ -DBUILD_LAPACK_DEPRECATED=ON ^ -DFIXED_LIBNAME=1 ^ -DBUFFERSIZE=20 ^ From 8d6eb00a6c2fb24bb971d0d617543f4cccd8ebfb Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 19 Nov 2026 06:07:44 +0200 Subject: [PATCH 07/14] disable Makefile/bash based windows build --- .github/workflows/windows.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ff87eeab..6aa78e06 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -26,6 +26,7 @@ env: jobs: build: + if: false # disable strategy: matrix: plat: ['x64'] @@ -171,6 +172,7 @@ jobs: github.repository == 'MacPython/openblas-libs' && !inputs.publish && github.event_name != 'pull_request' + && false # disable name: Upload to anaconda.org needs: build runs-on: ubuntu-latest From f6e4bd713c49eb8bd6ee45e32c75ab7abf192e24 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 19 Nov 2026 06:13:04 +0200 Subject: [PATCH 08/14] fix linking runtime path and compilation flags --- tools/build_steps_win.bat | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tools/build_steps_win.bat b/tools/build_steps_win.bat index a95a1924..a4f925d1 100755 --- a/tools/build_steps_win.bat +++ b/tools/build_steps_win.bat @@ -189,6 +189,32 @@ if errorlevel 1 ( clang-cl --version flang --version +REM flang's objects carry a /DEFAULTLIB:flang_rt.runtime.dynamic directive, but +REM OpenBLAS links the DLL with a hand-written lld-link call (no flang driver, +REM no /LIBPATH), so the runtime archive must be findable through LIB. It +REM lives in LLVM's per-target resource directory, whose version component +REM tracks the LLVM release, so look it up rather than hardcoding it. +if "%PLAT%"=="arm64" ( + set "flang_rt_triple=aarch64-pc-windows-msvc" +) else ( + set "flang_rt_triple=x86_64-pc-windows-msvc" +) +REM "for /d" over a quoted wildcard matches nothing, and the path has a space +REM in it, so list the version directories with dir instead. +set "clang_res_root=C:\Program Files\LLVM\lib\clang" +set "FLANG_RT_DIR=" +for /f "delims=" %%v in ('dir /b /ad "%clang_res_root%" 2^>NUL') do ( + if exist "%clang_res_root%\%%v\lib\%flang_rt_triple%\flang_rt.runtime.dynamic.lib" set "FLANG_RT_DIR=%clang_res_root%\%%v\lib\%flang_rt_triple%" +) +if not defined FLANG_RT_DIR ( + echo Error: no flang_rt.runtime.dynamic.lib for %flang_rt_triple% under + echo "%clang_res_root%" - the DLL link would fail with + echo "lld-link: error: could not open flang_rt.runtime.dynamic.lib". + exit /b 1 +) +echo Using flang runtime from "%FLANG_RT_DIR%" +set "LIB=%FLANG_RT_DIR%;%LIB%" + REM Run CMake and Ninja build REM CONSISTENT_FPCSR is x86-only: it makes blas_server_win32.c save and restore @@ -200,9 +226,15 @@ if "%PLAT%"=="arm64" ( set "arch_flags=-DTARGET=PRESCOTT -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST=NEHALEM;SANDYBRIDGE;HASWELL;SKYLAKEX -DCONSISTENT_FPCSR=1" ) -set CFLAGS=-Wno-reserved-macro-identifier -Wno-unsafe-buffer-usage -Wno-unused-macros -Wno-sign-conversion -Wno-reserved-identifier +REM OpenBLAS's cmake/cc.cmake appends -Wall for any Clang, but clang-cl parses +REM -Wall as MSVC /Wall, i.e. -Weverything: that produced 63k warnings and a +REM 30MB log. It is appended to CMAKE_C_FLAGS after anything we put in CFLAGS, +REM so the only slot that lands later is CMAKE_C_FLAGS_RELEASE. +set CFLAGS= +set "release_flags=/MD /O2 /Ob2 /DNDEBUG -Wno-everything" cmake .. -G Ninja ^ -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_C_FLAGS_RELEASE="%release_flags%" ^ -DBINARY=%build_bits% ^ -DCMAKE_C_COMPILER=clang-cl ^ -DCMAKE_Fortran_COMPILER=flang ^ From 06093c6c2aba8e0b55245557579992f006084582 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 19 Nov 2026 07:58:34 +0200 Subject: [PATCH 09/14] use correct flang license for statically linked flang runtime --- tools/LICENSE_win_flang.txt | 324 ++++++++++++++++++++++++++++++++++++ tools/build_steps_win.bat | 4 +- 2 files changed, 325 insertions(+), 3 deletions(-) create mode 100644 tools/LICENSE_win_flang.txt diff --git a/tools/LICENSE_win_flang.txt b/tools/LICENSE_win_flang.txt new file mode 100644 index 00000000..0a79b382 --- /dev/null +++ b/tools/LICENSE_win_flang.txt @@ -0,0 +1,324 @@ + +---- + +This binary distribution of NumPy also bundles the following software: + + +Name: OpenBLAS +Files: libs/libscipy_openblas*.dll +Description: bundled as a dynamically linked library +Availability: https://github.com/OpenMathLib/OpenBLAS/ +License: BSD-3-Clause-Attribution + Copyright (c) 2011-2014, The OpenBLAS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of the OpenBLAS project nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Name: LAPACK +Files: libs/libscipy_openblas*.dll +Description: bundled in OpenBLAS +Availability: https://github.com/OpenMathLib/OpenBLAS/ +License: BSD-3-Clause-Attribution + Copyright (c) 1992-2013 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. + Copyright (c) 2000-2013 The University of California Berkeley. All + rights reserved. + Copyright (c) 2006-2013 The University of Colorado Denver. All rights + reserved. + + $COPYRIGHT$ + + Additional copyrights may follow + + $HEADER$ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + + - Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + The copyright holders provide no reassurances that the source code + provided does not infringe any patent, copyright, or any other + intellectual property rights of third parties. The copyright holders + disclaim any liability to any recipient for claims brought against + recipient by any third party for infringement of that parties + intellectual property rights. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Name: Flang runtime library +Files: libs/libscipy_openblas*.dll +Description: statically linked into files compiled with LLVM flang +Availability: https://github.com/llvm/llvm-project/tree/main/flang-rt +License: Apache-2.0-with-LLVM-exception + ============================================================================== + The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: + ============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + ---- LLVM Exceptions to the Apache 2.0 License ---- + + As an exception, if, as a result of your compiling your source code, portions + of this Software are embedded into an Object form of such source code, you + may redistribute such embedded portions in such Object form without complying + with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + + In addition, if you combine or link compiled forms of this Software with + software that is licensed under the GPLv2 ("Combined Software") and if a + court of competent jurisdiction determines that the patent provision (Section + 3), the indemnity provision (Section 9) or other Section of the License + conflicts with the conditions of the GPLv2, you may retroactively and + prospectively choose to deem waived or otherwise exclude such Section(s) of + the License, but only in their entirety and only with respect to the Combined + Software. diff --git a/tools/build_steps_win.bat b/tools/build_steps_win.bat index a4f925d1..34448cb4 100755 --- a/tools/build_steps_win.bat +++ b/tools/build_steps_win.bat @@ -322,12 +322,10 @@ if errorlevel 1 ( exit /b 1 ) -REM Append the bundled-software notices to LICENSE.txt, as the posix build and -REM the old mingw Windows build both do. (echo.)>> LICENSE.txt (echo ----)>> LICENSE.txt (echo.)>> LICENSE.txt -type tools\LICENSE_win32.txt >> LICENSE.txt +type tools\LICENSE_win_flang.txt >> LICENSE.txt if errorlevel 1 exit /b 1 REM Build the Wheel & Install It From f105a5f7b84229b0af704a1db2b6f40ca5810ba0 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 19 Nov 2026 07:59:07 +0200 Subject: [PATCH 10/14] ship cmake config files --- tools/OpenBLASConfig.cmake.in | 35 +++++++++++++++++++++++++++++++++ tools/build_steps_win.bat | 37 +++++++++++++++++++++++++++-------- 2 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 tools/OpenBLASConfig.cmake.in diff --git a/tools/OpenBLASConfig.cmake.in b/tools/OpenBLASConfig.cmake.in new file mode 100644 index 00000000..5e6396b9 --- /dev/null +++ b/tools/OpenBLASConfig.cmake.in @@ -0,0 +1,35 @@ +# OpenBLASConfig.cmake for the scipy_openblas wheels. +# +# OpenBLAS's own cmake export (OpenBLASConfig.cmake plus an +# OpenBLASTargets.cmake that it does not write into the build tree) describes +# the layout of "make install", where the DLL lands in bin/. In these wheels +# everything lives in /lib, so build_steps_win.bat writes this file +# from tools/OpenBLASConfig.cmake.in instead. +# +# Sets: +# OpenBLAS_VERSION - version of the bundled OpenBLAS +# OpenBLAS_INCLUDE_DIR - directory holding the headers +# OpenBLAS_INCLUDE_DIRS - same as above +# OpenBLAS_LIBRARY - import library to link against +# OpenBLAS_LIBRARIES - same as above +# OpenBLAS_FOUND - TRUE +# and defines the imported target OpenBLAS::OpenBLAS. + +set(OpenBLAS_VERSION "@VERSION@") + +get_filename_component(_OpenBLAS_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) + +set(OpenBLAS_INCLUDE_DIR "${_OpenBLAS_ROOT_DIR}/include") +set(OpenBLAS_INCLUDE_DIRS "${OpenBLAS_INCLUDE_DIR}") +set(OpenBLAS_LIBRARY "${_OpenBLAS_ROOT_DIR}/lib/@LIBNAME@.lib") +set(OpenBLAS_LIBRARIES "${OpenBLAS_LIBRARY}") + +if (NOT TARGET OpenBLAS::OpenBLAS) + add_library(OpenBLAS::OpenBLAS SHARED IMPORTED) + set_target_properties(OpenBLAS::OpenBLAS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OpenBLAS_INCLUDE_DIR}" + IMPORTED_LOCATION "${_OpenBLAS_ROOT_DIR}/lib/@LIBNAME@.dll" + IMPORTED_IMPLIB "${OpenBLAS_LIBRARY}") +endif () + +set(OpenBLAS_FOUND TRUE) diff --git a/tools/build_steps_win.bat b/tools/build_steps_win.bat index 34448cb4..b8add537 100755 --- a/tools/build_steps_win.bat +++ b/tools/build_steps_win.bat @@ -112,10 +112,18 @@ if "%NIGHTLY%"=="true" ( for /f "tokens=3 delims= " %%v in ('findstr /b "version = " ..\pyproject.toml') do set version=%%v set version=%version:"=% -REM cwd is already OpenBLAS here, so the source is Makefile.rule, not -REM OpenBLAS/Makefile.rule -- that path never existed, Get-Content errored, -REM and the VERSION substitution silently never happened. -powershell -Command "(Get-Content Makefile.rule) -replace '^VERSION = .*', 'VERSION = %version%' | Set-Content Makefile.rule" +REM The cmake build ignores Makefile.rule and takes the version from +REM CMakeLists.txt, which bakes it into scipy-openblas.pc, +REM OpenBLASConfigVersion.cmake and the OPENBLAS_VERSION in openblas_config.h +REM that openblas_get_config() reports. Without this it stays at 0.3.34.dev. +powershell -Command "(Get-Content CMakeLists.txt) -replace '^set\(OpenBLAS_VERSION .*', 'set(OpenBLAS_VERSION \"%version%\")' | Set-Content CMakeLists.txt" +if errorlevel 1 exit /b 1 +findstr /b /c:"set(OpenBLAS_VERSION" CMakeLists.txt +findstr /b /c:"set(OpenBLAS_VERSION" CMakeLists.txt | findstr /c:"%version%" >NUL +if errorlevel 1 ( + echo Error: could not set OpenBLAS_VERSION to %version% in CMakeLists.txt. + exit /b 1 +) REM Set suffixed-ILP64 flags if "%if_bits%"=="64" ( @@ -275,7 +283,7 @@ if "%if_bits%"=="32" ( REM Prepare destination directory cd OpenBLAS/build echo Preparing destination directory at %DEST_DIR% -if not exist "%DEST_DIR%\lib\cmake\OpenBLAS" mkdir "%DEST_DIR%\lib\cmake\OpenBLAS" +if not exist "%DEST_DIR%\lib\cmake\openblas" mkdir "%DEST_DIR%\lib\cmake\openblas" if not exist "%DEST_DIR%\include" mkdir "%DEST_DIR%\include" REM Move library files @@ -294,9 +302,22 @@ if exist lib\release ( exit /b 1 ) -REM Copy CMake configuration files -echo Copying CMake configuration files... -if exist openblasconfig.cmake copy /Y openblasconfig.cmake "%DEST_DIR%\lib\cmake\openblas\" +REM Write the CMake package configuration. OpenBLAS generates +REM OpenBLASConfig.cmake, which include()s an OpenBLASTargets.cmake +REM describing the "make install" layout; neither suits the wheel, so write +REM our own from the template and keep OpenBLAS's version file. +echo Writing CMake configuration files... +if "%if_bits%"=="64" ( + set "cm_libname=scipy_openblas_64" +) else ( + set "cm_libname=scipy_openblas" +) +powershell -Command "(Get-Content '%~dp0OpenBLASConfig.cmake.in') -replace '@VERSION@', '%version%' -replace '@LIBNAME@', '%cm_libname%' | Set-Content '%DEST_DIR%\lib\cmake\openblas\OpenBLASConfig.cmake'" +if errorlevel 1 exit /b 1 +if not exist "%DEST_DIR%\lib\cmake\openblas\OpenBLASConfig.cmake" ( + echo Error: failed to write OpenBLASConfig.cmake. + exit /b 1 +) if exist openblasconfigversion.cmake copy /Y openblasconfigversion.cmake "%DEST_DIR%\lib\cmake\openblas\" REM Copy header files From da567023acfd3cef9b92969602c14a377f13f8a8 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 19 Nov 2026 10:33:43 +0200 Subject: [PATCH 11/14] extralibs no longer needs qaudmath or gfortran --- local/scipy_openblas64/__init__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/local/scipy_openblas64/__init__.py b/local/scipy_openblas64/__init__.py index 06bb744e..82264580 100644 --- a/local/scipy_openblas64/__init__.py +++ b/local/scipy_openblas64/__init__.py @@ -8,7 +8,6 @@ import re import sys from textwrap import dedent -import platform _HERE = Path(__file__).resolve().parent @@ -74,12 +73,10 @@ def get_pkg_config(use_preloading=False, use_prefix=False): """ extralib = "" if sys.platform == "win32": - machine = platform.machine().lower() - if machine != "arm64": - extralib = "-defaultlib:advapi32 -lgfortran -lquadmath" + extralib = "-defaultlib:advapi32" libs_flags = f"-L${{libdir}} -l{get_library()}" else: - extralib = f"-lm -lpthread -lgfortran -lquadmath -L${{libdir}} -l{get_library()}" + extralib = f"-lm -lpthread -L${{libdir}} -l{get_library()}" if use_preloading: libs_flags = "" else: From 67d29cb0d58cb47fc435ee565ba6c704e28999bf Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 19 Nov 2026 10:35:04 +0200 Subject: [PATCH 12/14] use /Gy to try to figure out why clang/flang is larger than gcc/gfortran --- tools/build_steps_win.bat | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/build_steps_win.bat b/tools/build_steps_win.bat index b8add537..d7083447 100755 --- a/tools/build_steps_win.bat +++ b/tools/build_steps_win.bat @@ -239,10 +239,15 @@ REM -Wall as MSVC /Wall, i.e. -Weverything: that produced 63k warnings and a REM 30MB log. It is appended to CMAKE_C_FLAGS after anything we put in CFLAGS, REM so the only slot that lands later is CMAKE_C_FLAGS_RELEASE. set CFLAGS= -set "release_flags=/MD /O2 /Ob2 /DNDEBUG -Wno-everything" +REM /Gy (clang-cl) and -ffunction-sections (flang) put each function in its own +REM COMDAT so lld-link's /OPT:REF, which is on by default when no /DEBUG is +REM passed, has something to discard; without them each object contributes one +REM monolithic .text and nothing can be dropped. +set "release_flags=/MD /O2 /Ob2 /DNDEBUG -Wno-everything /Gy" cmake .. -G Ninja ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_C_FLAGS_RELEASE="%release_flags%" ^ + -DCMAKE_Fortran_FLAGS="-ffunction-sections" ^ -DBINARY=%build_bits% ^ -DCMAKE_C_COMPILER=clang-cl ^ -DCMAKE_Fortran_COMPILER=flang ^ From 3080832eec588859c5820eb32fb1d28e49068c26 Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 20 Nov 2026 00:17:44 +0200 Subject: [PATCH 13/14] use msys2 on windows.yml builds instead of rtools4.5 --- .github/workflows/windows.yml | 30 +++++++++++++++++++----------- tools/build_steps_win.bat | 5 ----- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6aa78e06..453e7567 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -22,11 +22,9 @@ env: # Preserve working directory for calls into bash # Without this, invoking bash will cd to the home directory CHERE_INVOKING: "yes" - BASH_PATH: "c:\\rtools45\\usr\\bin\\bash.exe" jobs: build: - if: false # disable strategy: matrix: plat: ['x64'] @@ -44,17 +42,26 @@ jobs: timeout-minutes: 90 steps: - uses: actions/checkout@v6.0.1 - # Already installed - # - name: install-rtools - # run: | - # choco install -y rtools --no-progress --force --version=4.5.6768 + + - name: Install MSYS2 toolchain + uses: msys2/setup-msys2@v2.33.0 + with: + msystem: UCRT64 + update: true + install: >- + git + make + zip + unzip + pacboy: >- + cc:p + fc:p - name: Set env variables run: | echo "START_DIR=$PWD" >> $env:GITHUB_ENV echo "PLAT=x86_64" >> $env:GITHUB_ENV echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV - echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV echo "LDFLAGS=-lucrt -static -static-libgcc -Wl,--defsym,quadmath_snprintf=snprintf" >> $env:GITHUB_ENV echo "BUILD_BITS=64" >> $env:GITHUB_ENV if ( ${{ matrix.INTERFACE64 }} -eq "1" ) { @@ -69,15 +76,17 @@ jobs: echo CIBW_ENVIRONMENT_WINDOWS=$env:CIBW_ENVIRONMENT_WINDOWS - name: Build + shell: msys2 {0} run: | git submodule update --init --recursive - & $env:BASH_PATH -lc tools/build_steps_windows.sh + tools/build_steps_windows.sh - name: Test + shell: msys2 {0} run: | - & $env:BASH_PATH -lc tools/build_gfortran.sh + tools/build_gfortran.sh echo "Dynamic test" - .\for_test\test_dyn.exe + ./for_test/test_dyn.exe - name: Copy run: | @@ -172,7 +181,6 @@ jobs: github.repository == 'MacPython/openblas-libs' && !inputs.publish && github.event_name != 'pull_request' - && false # disable name: Upload to anaconda.org needs: build runs-on: ubuntu-latest diff --git a/tools/build_steps_win.bat b/tools/build_steps_win.bat index d7083447..fcb7b8a3 100755 --- a/tools/build_steps_win.bat +++ b/tools/build_steps_win.bat @@ -239,15 +239,10 @@ REM -Wall as MSVC /Wall, i.e. -Weverything: that produced 63k warnings and a REM 30MB log. It is appended to CMAKE_C_FLAGS after anything we put in CFLAGS, REM so the only slot that lands later is CMAKE_C_FLAGS_RELEASE. set CFLAGS= -REM /Gy (clang-cl) and -ffunction-sections (flang) put each function in its own -REM COMDAT so lld-link's /OPT:REF, which is on by default when no /DEBUG is -REM passed, has something to discard; without them each object contributes one -REM monolithic .text and nothing can be dropped. set "release_flags=/MD /O2 /Ob2 /DNDEBUG -Wno-everything /Gy" cmake .. -G Ninja ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_C_FLAGS_RELEASE="%release_flags%" ^ - -DCMAKE_Fortran_FLAGS="-ffunction-sections" ^ -DBINARY=%build_bits% ^ -DCMAKE_C_COMPILER=clang-cl ^ -DCMAKE_Fortran_COMPILER=flang ^ From d81de76148fffc8ba47b6f89776aefb79a1f3b5c Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 20 Nov 2026 08:54:54 +0200 Subject: [PATCH 14/14] use -O2 for flang compilation --- tools/build_steps_win.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build_steps_win.bat b/tools/build_steps_win.bat index fcb7b8a3..5116e75b 100755 --- a/tools/build_steps_win.bat +++ b/tools/build_steps_win.bat @@ -239,10 +239,11 @@ REM -Wall as MSVC /Wall, i.e. -Weverything: that produced 63k warnings and a REM 30MB log. It is appended to CMAKE_C_FLAGS after anything we put in CFLAGS, REM so the only slot that lands later is CMAKE_C_FLAGS_RELEASE. set CFLAGS= -set "release_flags=/MD /O2 /Ob2 /DNDEBUG -Wno-everything /Gy" +set "release_flags=/MD /O2 /Ob2 /DNDEBUG -Wno-everything" cmake .. -G Ninja ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_C_FLAGS_RELEASE="%release_flags%" ^ + -DCMAKE_Fortran_FLAGS_RELEASE="-O2 -DNDEBUG" ^ -DBINARY=%build_bits% ^ -DCMAKE_C_COMPILER=clang-cl ^ -DCMAKE_Fortran_COMPILER=flang ^