20

Is it possible to build Python interpreter from source with Mingw and gcc on Windows 7? And I would like to biuld a 64bit version.

If a 64bit Python (gcc Mingw) version is available for download please let me know, I would use that also. At the end I still would like to compile it with gcc and mingw.

Theuns Heydenrych
  • 449
  • 1
  • 4
  • 12

2 Answers2

8

First off, you do not need to build Python with MinGW-w64 to link to it and embed a interpreter. Just extract the msi installer, and use the prebuilt DLL. Note you'll have to be careful not to mix msvcr[t|90].dll objects, but I've never seen that be a real issue personally.

MinGW-w64 gcc/ld should be able to link to DLL's directly, otherwise you'll have to use gendef to create a .def file and dlltool to create an import library.

Secondly, there's a patchset to build Python with MinGW, but I'm not sure about its 64-bit compatibility.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
  • Thank you for the reply. The reason for this, is I would like to compile Quantum-Gis for 64 bit with mingw and gcc. Quatum-Gis have capability for utilising plugins written in python or c++. For this I need Sip and PyQt4 in 64bit for Win7. I went through the gendef/nm process to create the libpython27.a file. I started to build Sip with Mingw and gcc and Python 2.7.3 all in 64bit, successfully, I also could test Sip in a python console. I successfully compiled PyQt4 and install it, but when testing it in a python console it just fails. – Theuns Heydenrych Mar 12 '13 at 17:37
  • I don't know how to debug this failure? Because of this failure I reasoned that maybe I need to compile Python 2.7.3 with mingw and gcc in 64bit. In your opinion, if I download pre-build 64 bit Sip and PyQt4 binaries that is build with MSVC, would I have problems later on with other python scripts/plugins written against these binaries? – Theuns Heydenrych Mar 12 '13 at 17:46
  • @TheunsHeydenrych That I don't know. I would suggest asking the `mingw-w64-public@sourceforge.net` mailing list, where a couple of people use Python with MinGW-w64. All I do is link `gdb` to Python, which works as I described `;-)`. – rubenvb Mar 12 '13 at 19:07
  • Searching the tracker for 'mingw' returns about 50 open issues and 100 closed issues. Some of the recent open issues might be helpful. – Terry Jan Reedy Jul 26 '13 at 23:32
  • 1
    Personally, I used a [mingw64 build](http://netcologne.dl.sourceforge.net/project/mingwbuilds/host-windows/releases/4.8.1/64-bit/threads-win32/seh/x64-4.8.1-release-win32-seh-rev5.7z) that already includes a version of python 2.7. – Gauthier Boaglio Nov 24 '13 at 13:23
4

You may try this repository:

hg clone https://bitbucket.org/puqing/python-mingw

It is a copy of the official repository but contains some modification to make it compile with mingw. Enter PC/MinGW directory:

cd PC/MinGW && make

Not sure if it compiles in win64, but with win32 and msys it should work.

cpq
  • 157
  • 1
  • 4