Python for amd64 and mingw-w64

D

David Cournapeau

Hi,

I want to build python extensions with mingw-w64 on windows 64 bits. I
found some problems which I think are python bugs/deficiencies, but
would like a confirmation:

- Any extension requires the MS_WIN64 to be defined, but this symbol
is only defined for MS compiler (in PC/pyport.h). Shouldn't it be
defined independantly of the compiler ? One problem is that without
this defines, SIZEOF_SIZE_T is set to 4 with gcc. Another consequence
which can be seen even through a trivial , do nothing extension is
that Py_InitModule4 is used (whereas the same source file will use
Py_InitModule4_64, which is used when SIZEOF_SIZE_T !=SIZEOF_INT, in
include/modsupport.h).
- I have some link problems related to Py_InitModule4_64. I believe
the problem is in libpython26.a, which according to nm does not have
this symbol defined, whereas python26.dll has.

thanks,

David
 
M

Martin v. Löwis

- Any extension requires the MS_WIN64 to be defined, but this symbol
is only defined for MS compiler (in PC/pyport.h).

Why do you say that? It is only defined when _WIN64 is defined; this
has nothing to do with a MS compiler.
Shouldn't it be
defined independantly of the compiler ?

You mean, completely unconditional? Definitely not, it should only
be defined when you are compiling for 64-bit mode.
- I have some link problems related to Py_InitModule4_64. I believe
the problem is in libpython26.a, which according to nm does not have
this symbol defined, whereas python26.dll has.

It's a mistake if libpython26.a gets included in the Win64 installer
at all; this library is only provided for 32-bit systems. My copy of
mingw doesn't support Win64 at all.

Regards,
Martin
 
M

Martin v. Löwis

- Any extension requires the MS_WIN64 to be defined, but this symbol
is only defined for MS compiler (in PC/pyport.h).

Why do you say that? It is only defined when _WIN64 is defined; this
has nothing to do with a MS compiler.
Shouldn't it be
defined independantly of the compiler ?

You mean, completely unconditional? Definitely not, it should only
be defined when you are compiling for 64-bit mode.
- I have some link problems related to Py_InitModule4_64. I believe
the problem is in libpython26.a, which according to nm does not have
this symbol defined, whereas python26.dll has.

It's a mistake if libpython26.a gets included in the Win64 installer
at all; this library is only provided for 32-bit systems. My copy of
mingw doesn't support Win64 at all.

Regards,
Martin
 
D

David Cournapeau

It's a mistake if libpython26.a gets included in the Win64 installer
at all; this library is only provided for 32-bit systems. My copy of
mingw doesn't support Win64 at all.

Please ignore that last point: it looks like it is generated by our
(numpy) build process, and has nothing to do with python per-se.

David
 
D

David Cournapeau

Why do you say that? It is only defined when _WIN64 is defined; this
has nothing to do with a MS compiler.


You mean, completely unconditional? Definitely not, it should only
be defined when you are compiling for 64-bit mode.

I put a more detailed explanation of the problem with an example + a
patch on the bug tracker:

http://bugs.python.org/issue4709

This is the only problem on python side of things to make extensions
buildable on windows x64 (all the other problems I have encountered so
far to make numpy build with mingw-w64 are numpy's or mingw-w64).

David
 
M

Martin v. Löwis

This is the only problem on python side of things to make extensions
buildable on windows x64 (all the other problems I have encountered so
far to make numpy build with mingw-w64 are numpy's or mingw-w64).

Thanks!

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top