-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BLD: mingw-w64 build fixes #24968
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
BLD: mingw-w64 build fixes #24968
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hmm, seems reasonable to me. |
rgommers
reviewed
Oct 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lazka. Yes, we're happy to support Mingw-built Python, that seems like a worthwhile thing and I never really understand the problem CPython devs had with accepting patches.
A few comments on these changes.
In MSYS2 we build numpy like Linux distros, so we prefer dynamic linking and it needs to be ABI compatible with all other packages. numpy by default statically links ucrt and changes the ABI to match MSVC, which makes it incompatible with other packages. To differentiate the two use cases detect if we are building against a mingww-64 Python build, and if we are skip all the special adjustments. Note that mingw-w64 is not officially supported by upstream CPython.
mingw-w64 nowadays is also available in combination with Clang, for example https://github.com/mstorsjo/llvm-mingw or MSYS2 provide Clang builds using mingw-w64. Instead of testing for GCC check that __MINGW32__ is defined.
862fd82
to
9123d43
Compare
|
Thanks @lazka |
Thanks! $ python3 -m venv _venvnumpy
$ source _venvnumpy/bin/activate
$ pip install git+https://github.com/numpy/numpy
Collecting git+https://github.com/numpy/numpy
Cloning https://github.com/numpy/numpy to c:/msys64/tmp/pip-req-build-fnyfgf0b
Running command git clone --filter=blob:none --quiet https://github.com/numpy/numpy C:/msys64/tmp/pip-req-build-fnyfgf0b
Resolved https://github.com/numpy/numpy to commit 29cbb1f0a7f339dc350ecf3fc81de9e9c570f6db
Running command git submodule update --init --recursive -q
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: numpy
Building wheel for numpy (pyproject.toml) ... done
Created wheel for numpy: filename=numpy-2.0.0.dev0-cp311-cp311-mingw_x86_64_clang.whl size=7316554 sha256=d993e6729218e1aecb5fcfe84a33e999456a7dc53c73606780e2e2ee98ddb0a2
Stored in directory: C:/msys64/tmp/pip-ephem-wheel-cache-n4_gvqoz/wheels/61/82/88/254b39bf4fea16d2cf792805b8284966388b27bdfe9533da7c
Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-2.0.0.dev0
[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: python3.exe -m pip install --upgrade pip
$ python3 -c "import numpy; print(numpy)"
<frozen importlib._bootstrap>:241: Warning: Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for
testing. You are advised not to use it for production.
CRASHES ARE TO BE EXPECTED - PLEASE REPORT THEM TO NUMPY DEVELOPERS
<module 'numpy' from 'C:/msys64/home/user/_venvnumpy/lib/python3.11/site-packages/numpy/__init__.py'> |
7 tasks
charris
added a commit
that referenced
this pull request
Nov 6, 2023
charris
added a commit
to charris/numpy
that referenced
this pull request
Nov 11, 2023
Backports of numpy#24969, numpy#24979, numpy#24968, numpy#25068. * apply 24969.diff * apply 24979.diff * apply 24968.diff * TST: skip flaky test in test_histogram --------- Co-authored-by: mattip <matti.picus@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two commits to make the build with mingw-w64 work. Note that this is using mingw-w64 Python, which is not officially supported by upstream CPython. I hope the changes here are small/clear enough to still be considered.
See the commit messages for details