Skip to content

Add MINGW64 support on MSYS2 platform#124

Closed
gokhanettin wants to merge 1 commit into
python-greenlet:masterfrom
gokhanettin:master
Closed

Add MINGW64 support on MSYS2 platform#124
gokhanettin wants to merge 1 commit into
python-greenlet:masterfrom
gokhanettin:master

Conversation

@gokhanettin

Copy link
Copy Markdown
Contributor

It seems we can not build with x86_64-w64-mingw32-gcc.exe on MSYS2 due
to the fact that

  • sizeof(long) is different on general UNIX and MINGW64, 8 and 4,
    respectively.
  • Assumption on MSVC compiler if sys.platform is win32 in setup.py.

Using long long instead of long and handling GCC cases on win32
platforms seem to be enough for MINGW64 support without breaking
anything.

Credit goes to http://proglab.blog.fc2.com/blog-entry-48.html and Google
Translate.

It seems we can not build with `x86_64-w64-mingw32-gcc.exe` on MSYS2 due
to the fact that

- `sizeof(long)` is different on general UNIX and MINGW64, 8 and 4,
respectively.
- Assumption on MSVC compiler if `sys.platform` is win32 in setup.py.

Using `long long` instead of `long` and handling GCC cases on win32
platforms seem to be enough for MINGW64 support without breaking
anything.

Credit goes to http://proglab.blog.fc2.com/blog-entry-48.html and Google
Translate.
@snaury

snaury commented Jan 28, 2018

Copy link
Copy Markdown
Contributor

Thank you for the patch, however I'm afraid this patch may be incorrect, even if it happens to work for you in some cases. As far as I remember, win64 has ABI that is very different to other operating systems, so using switch_amd64_unix.h on win64 feels wrong. For some reference, compare which registers are saved in boost.context between platforms:

You would notice, that windows requires xmm6-xmm15, as well as rsi and rdi to be saved.

I vaguely remember that it was actually possible to use platform/switch_x64_masm.obj with mingw64, although to be honest I haven't been developing on Windows for almost 4 years and might be mistaken.

@gokhanettin

Copy link
Copy Markdown
Contributor Author

I see. platform/switch_x64_masm.obj makes more sense. Thanks for the detailed explanation. I will send another PR for it.

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

Successfully merging this pull request may close these issues.

2 participants