Open casevh opened 2 years ago
Sorry. I can't get it to work
Nevermind. I just got a linux VM and it works... Sorry for the trouble....
@casevh
First, thanks a lot for this input which gave me the energy to give a try myself.
I have been able to build a Cython extension with MS Visual studio linked to the GMP, MPFR, and MPC dlls included with the last gmpy2 binary and also numpy libraries. This build was run on a github-runner and the script is available, (as I do not have access to a windows machine it included a few shots in the dark)...
The cython extension code : https://github.com/GBillotey/Fractalshades/blob/master/src/fractalshades/mpmath_utils/FP_loop.pyx
The key parts
I think including the headers and .lib files as data files within gmpy2 windows distribution would ease a lot the process, that could be run with a standard python setup.
The final content of gmpy2 install folder before running the build is
executed, folder content:
['gmp.h', 'gmpy2.cp38-win_amd64.pyd', 'gmpy2.h', 'gmpy2.pxd', 'libgcc_s_seh-1.dll', 'libgcc_s_seh-1.lib', 'libgmp-10.dll', 'libgmp-10.lib', 'libmpc-3.dll', 'libmpc-3.lib', 'libmpfr-6.dll', 'libmpfr-6.lib', 'libwinpthread-1.dll', 'libwinpthread-1.lib', 'mpc.h', 'mpf2mpfr.h', 'mpfr.h', '__init__.pxd', '__init__.py', '__pycache__']
The windows test suite still have unrelated fails, however the keys tests that call this library passed. When the script is more polished I would be happy to share or contribute to gmpy2 documentation if it is considered a useful point.
@GBillotey
Thank you! You gave me a nudge in the right direction. I'll try to look at it this weekend.
BTW, fractalshades looks cool.
casevh
Thanks for the feedback on fractalshades! This is a "home-entertainment" application of gmpy, in a way ;) Being able to compile it under windows would probably make it usable by more people.
Just a quick update : I pushed the Windows binary wheels for this project to pypi, and can confirm a "pip install" just works - gmpy2 is specified as an install dependency for the package.
This issue is occurring again as of Python 3.12 ( I assume because there's no pre-built wheel for Windows for 3.12 ) , I have Visual Studio 22 installed but pip can't find the gmp.h file to build
Can you try compiling gmpy2 from source? After cloning the source, run the following command(s) using the "x64 Native Tools Command Prompt".
py -3.12 setup.py build_ext --force bdist_wheel
or
py -3.12 -m pip install build py -3.12 -m build --wheel
Both commands should result in a binary wheel.
Please let me know if this doesn't work.
casevh
On Mon, Oct 23, 2023 at 9:51 PM Kalanyr @.***> wrote:
This issue is occurring again as of Python 3.12 ( I assume because there's no pre-built wheel for Windows for 3.12 ) , I have Visual Studio 22 installed but pip can't find the gmp.h file to build
— Reply to this email directly, view it on GitHub https://github.com/aleaxit/gmpy/issues/320#issuecomment-1776535338, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMR23ZQP5WUTOTQWRTMABDYA5CMVAVCNFSM5KPKKEX2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXGY2TGNJTGM4A . You are receiving this because you were mentioned.Message ID: @.***>
It is possible to build a Cython extension on Windows using the GMP, MPFR, and MPC DLLs included with the gmpy2 binary wheel.
Here is the rough outline:
https://github.com/brechtsanders/winlibs_mingw/releases/download/10.3.0-12.0.0-9.0.0-r2/winlibs-x86_64-posix-seh-gcc-10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2.zip
py39 setup_cython.py build_ext -cmingw32 -I..\mingw64\shared\include -L..\mingw64\shared\lib --inplace