kitao / pyxel

A retro game engine for Python
MIT License
14.67k stars 824 forks source link

Possible MinGW support (needs a bit of help) #566

Open JojoFR1 opened 6 days ago

JojoFR1 commented 6 days ago

Hi, I started to make this library into a MSYS2 MINGW64 package but ran into multiple issues and I would like to know if you could guide me to fix those. (I already spent 6 hours on this... I do not want to abandon)

Firstly everything is compiled and packaged fine (even though I had to patch a file because SDL2-static didn't exist and it was simply SDL2) but when installing the package and importing pyxel I only have pyxel.pyxel_wrapper available and nothing else. I also tried directly installing the wheel, which didn't work, pip telling me my system didn't support the wheel (maybe something to fo with MSYS environment) And the last issue is with pyxel.exe which simply doesn't work, giving this error: Fatal error in launcher: Unable to find an appended archive.

I do not ask for you to directly help me (and you might not have the time to) but more to guide me and fix those problems.

JojoFR1 commented 4 days ago

Some update about this, after some more research the wheel doesn't contains the python folder contents (except for the pyxel-wrapper.pyd file), thus why it can't find any methods/class but I do not know how to add them. Another issue is that the wheel is for win-amd64 while I need it to be mingw_x86_64 and, again, I do not know how to change that. (It might not be relevant, installing through pip is not possible but using te pacman package manager it works)

JojoFR1 commented 3 days ago

Another update, yet again, but it actually works.

I do have to import pyxel.pyxel_wrapper for it to work tho, as import pyxel doesn't work. The only issue then is the missing python folder which contains the __init__.py, the .pyi, etc...

If you have any clue as to why I would appreciate. Don't hesitate to ask me any missing information, I'll answer as quickly as possible.

kitao commented 3 days ago

Hi. When I tried MSYS2 environment before, I stopped it because it seems that MSYS2 env doesn't support Python ABI and maintaining new develop environment costs high regardless of MSYS2 supports Python ABI or not.

Can I ask what is your motivation?

JojoFR1 commented 3 days ago

Hi, thank you for the reply.

I do not know about ABI support, but since it successfully compiled Rust and made the wheel (which half work, as in it does technically work but it's missing all the python folder which is important for IDE suggestions, etc...) ABI might be now supported? As for my motive I just wanted to make this library a MSYS MinGW package so it's supported in that environment, and potentially, once this work, make a PR here to possibly fix the issues.

kitao commented 3 days ago

Sorry I should write "Stable ABI" (PEP384).

If MSYS2 doesn't support it yet, Pyxel doesn't have binary compatibility and only works on the same Python version it was compiled with. And it also may be possible that an external Stable-ABI-compatible module cannot be used with the MSYS2 version of Pyxel.

A several years ago, I learned about that and decided to stop using MSYS2 to create binaries for Windows. But I haven't kept up with the latest situation on this topic.

JojoFR1 commented 2 days ago

About the Stable ABI, I found those:

https://github.com/msys2-contrib/cpython-mingw/pull/148 https://github.com/msys2/MINGW-packages/pull/18238

Which visibly seems to add it. I understand if you do not want to waste your time doing that, I personally do not mind doing it but I just need to iron out those last few issues.