Skip to content

BLD: build wheels for 32-bit Python on Windows, using MSVC #24671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
- [ubuntu-20.04, musllinux_x86_64]
- [macos-12, macosx_x86_64]
- [windows-2019, win_amd64]
- [windows-2019, win32]
python: ["cp39", "cp310", "cp311", "cp312"] # "pp39"
exclude:
# Don't build PyPy 32-bit windows
Expand All @@ -98,6 +99,12 @@ jobs:
# https://github.com/actions/checkout/issues/338
fetch-depth: 0

- name: Setup MSVC (32-bit)
if: ${{ matrix.buildplat[1] == 'win32' }}
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: 'x86'

- name: pkg-config-for-win
run: |
choco install -y --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
Expand Down
4 changes: 4 additions & 0 deletions numpy/random/tests/test_extending.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
cython = None


@pytest.mark.skipif(
sys.platform == "win32" and sys.maxsize < 2**32,
reason="Failing in 32-bit Windows wheel build job, skip for now"
)
@pytest.mark.skipif(IS_WASM, reason="Can't start subprocess")
@pytest.mark.skipif(cython is None, reason="requires cython")
@pytest.mark.slow
Expand Down
14 changes: 6 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ tracker = "https://github.com/numpy/numpy/issues"
# Note: the below skip command doesn't do much currently, the platforms to
# build wheels for in CI are controlled in `.github/workflows/wheels.yml` and
# `tools/ci/cirrus_wheels.yml`.
skip = "cp36-* cp37-* cp-38* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64 *-win32"
skip = "cp36-* cp37-* cp-38* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64"
build-verbosity = "3"
before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}"
# meson has a hard dependency on ninja, and we need meson to build
Expand Down Expand Up @@ -179,17 +179,15 @@ test-skip = "*_universal2:arm64"
environment = {CFLAGS="-fno-strict-aliasing -DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", CXXFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", NPY_USE_BLAS_ILP64="1", CC="clang", CXX = "clang++", RUNNER_OS="macOS"}

[tool.cibuildwheel.windows]
archs = ['AMD64']
environment = {NPY_USE_BLAS_ILP64="1", CFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", CXXFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", LDFLAGS="", PKG_CONFIG_PATH="C:/opt/64/lib/pkgconfig"}
config-settings = "setup-args=--vsenv"
repair-wheel-command = "bash ./tools/wheels/repair_windows.sh {wheel} {dest_dir}"

#[[tool.cibuildwheel.overrides]]
# Note: 32-bit Python wheel builds are skipped right now; probably needs
# --native-file to build due to `arch != pyarch` check in Meson's `python` dependency
# Note: uses 32-bit rather than 64-bit OpenBLAS
#select = "*-win32"
#environment = CFLAGS="-m32", LDFLAGS="-m32", PKG_CONFIG_PATH="/opt/32/lib/pkgconfig"}
[[tool.cibuildwheel.overrides]]
select = "*-win32"
environment = {PKG_CONFIG_PATH="/opt/32/lib/pkgconfig"}
config-settings = "setup-args=--vsenv setup-args=-Dallow-noblas=true"
repair-wheel-command = ""

[tool.spin]
package = 'numpy'
Expand Down
4 changes: 4 additions & 0 deletions tools/wheels/cibw_test_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ if [[ $RUNNER_OS == "macOS" && $RUNNER_ARCH == "X64" ]]; then
# Needed so gfortran (not clang) can find system libraries like libm (-lm)
# in f2py tests
export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
elif [[ $RUNNER_OS == "Windows" && $IS_32_BIT == true ]] ; then
echo "Skip OpenBLAS version check for 32-bit Windows, no OpenBLAS used"
# Avoid this in GHA: "ERROR: Found GNU link.exe instead of MSVC link.exe"
rm /c/Program\ Files/Git/usr/bin/link.EXE
else
# For some reason the macos-x86_64 runner does not work with threadpoolctl
# Skip this check there
Expand Down
2 changes: 1 addition & 1 deletion tools/wheels/repair_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pushd numpy*
# building with mingw.
# We therefore find each PYD in the directory structure and strip them.

for f in $(find ./scipy* -name '*.pyd'); do strip $f; done
for f in $(find ./numpy* -name '*.pyd'); do strip $f; done


# now repack the wheel and overwrite the original
Expand Down