Skip to content
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

Support python 3.8+ #4

Open
icppWorld opened this issue Aug 31, 2024 · 6 comments
Open

Support python 3.8+ #4

icppWorld opened this issue Aug 31, 2024 · 6 comments

Comments

@icppWorld
Copy link

Currently, you require python 3.11 or higher. Can this be relaxed to require python 3.8 or higher?

Background:
I'd love to include your package as a dependency in icpp-pro, so I can add wasm optimizations into the build-process. However, we currently support Python 3.8 and up, and I would like to keep it that way.

Is there a specific reason to require python 3.11 ?

@jonathanharg
Copy link
Owner

I can't think of a specific reason to require Python 3.11. Maybe some modules use some of the newer type hinting features (this could be fixed easily). It's more about the fact that compiling binaryen and building different wheels for each version has been a real pain.

If you checkout the next branch, I have tried to add basic support for 3.8+ but I'm getting quite cryptic error messages from cibuildwheel and cffi. Windows doesn't seem to like Python >= 3.10 (something maybe to do with distutils?), and apple silicon doesn't seem to like Python 3.8.

I don't think it would be hard to support 3.8, just tedious. At the moment I don't have an easy way to test different OS/Python versions which makes debugging quite hard.

If we can get the package to compile to all platforms and versions of Python I'd be more than happy to create a new release.

@icppWorld
Copy link
Author

icppWorld commented Sep 1, 2024

Awesome, thank you for exploring this!

I will check out the next branch and dig into the messages.

The fact you have such a nice structure to compile binaryan on mac/linux/windows AND then distribute via python is amazing.

@icppWorld
Copy link
Author

@jonathanharg ,

The issue we see in the build is reported as an issue with the python-cffi/cffi team: python-cffi/cffi#117 : cffi relies on deprecated (now removed) distutils.msvc9compiler module

I have no solution yet, but wanted to share this finding.

@icppWorld
Copy link
Author

Pinning cffi to 1.15.0 fixes the current error, so it is indeed related to that, but then it runs into a build error later on.

[build-system]
requires = ["setuptools", "cffi==1.15.0"]

The next error is

 "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\a\binaryen.py\binaryen.py\binaryen\libbinaryen\x86_64-windows\include -IC:\Users\runneradmin\AppData\Local\Temp\cibw-run-8jel08kh\cp310-win_amd64\build\venv\include -IC:\Users\runneradmin\AppData\Local\pypa\cibuildwheel\Cache\nuget-cpython\python.3.10.11\tools\include -IC:\Users\runneradmin\AppData\Local\pypa\cibuildwheel\Cache\nuget-cpython\python.3.10.11\tools\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\P
    binaryen._binaryen.c
    "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\a\binaryen.py\binaryen.py\binaryen\libbinaryen\x86_64-windows\lib /LIBPATH:C:\Users\runneradmin\AppData\Local\Temp\cibw-run-8jel08kh\cp310-win_amd64\build\venv\libs /LIBPATH:C:\Users\runneradmin\AppData\Local\pypa\cibuildwheel\Cache\nuget-cpython\python.3.10.11\tools\libs /LIBPATH:C:\Users\runneradmin\AppData\Local\pypa\cibuildwheel\Cache\nuget-cpython\python.3.10.11\tools /LIBPATH:C:\Users\runneradmin\AppData\Local\Temp\cibw-run-8jel08kh\cp310-win_amd64\build\venv\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.2262
       Creating library build\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310\Release\_binaryen.lib and object build\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310\Release\_binaryen.exp
    LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
    binaryen._binaryen.obj : error LNK2001: unresolved external symbol BinaryenStringWTF8Advance
    binaryen._binaryen.obj : error LNK2001: unresolved external symbol BinaryenStringNewSetTry
    binaryen._binaryen.obj : error LNK2001: unresolved external symbol BinaryenStringIterNext
    binaryen._binaryen.obj : error LNK2001: unresolved external symbol BinaryenStringSliceIter
    binaryen._binaryen.obj : error LNK2001: unresolved external symbol BinaryenStringIterMove
    build\lib.win-amd64-cpython-310\binaryen\_binaryen.pyd : fatal error LNK1120: 5 unresolved externals
    error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120
    [end of output]
    ```
    
    Not sure yet what that could be...

@icppWorld
Copy link
Author

@jonathanharg

A potential fix is coming in this PR: python-cffi/cffi#120

That should allow us to build the wheels for python 3.10 without making any changes.

I am going to wait with further attempts until that PR is merged.

@jonathanharg
Copy link
Owner

@icppWorld it looks like there have been some fixes implemented as part of python-cffi/cffi#118. I'm not sure if there are related issues with ci-buildwheel, so I'm going to have a look and see if I can get it building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants