How to obtain pre-built *debug* version of Python library (e.g. Python27_d.dll) for Windows

codeasone picture codeasone · Apr 25, 2012 · Viewed 11.6k times · Source

Firstly, I should state that my current development environment is MSYS + mingw-w64 + ActivePython under Windows 7 and that on a normal day I am primarily a Linux developer. I am having no joy obtaining, or compiling, a version of the Python library with debug symbols.

I need both 32bit and 64bit debug versions of the Python27.dll file, ideally. I want to be able to embed Python and implement Python extensions in C++, and be able to call upon a seamless debugging facility using the gdb-7.4 I have built for mingw-w64, and WingIDE for the pure Python side of things.

Building Python 2.7.3 from source with my mingw-w64 toolchain is proving too problematic -- and before anyone flames me for trying: I acknowledge that this environment is unsupported, but I thought I might be able to get this working with a few judicious patches (hacks) and:

make OPT='-g -DMS_WIN32 -DWIN32 -DNDEBUG -D_WINDOWS -DUSE_DL_EXPORT'

I was wrong... I gave up at posixmodule.c since the impact of my changes became uncertain; ymmv.

I have tried building with Visual C++ 2010 Express but being primarily a Linux developer the culture-shock is too much for me to bear today; the Python project does not even import successfully. Apparently, I need Visual C++ 2008, yet I am already convinced I don't want to go down this road if at all possible...

It's really surprising to me that there is not a zip-file providing the requisite .dlls somewhere on the Internet. ActiveState should really provide these as an optional download with each release of ActivePython that they make -- perhaps that's where the paid support comes in ;-).

What is the best way to obtain the Python debug library files given my environment?

Answer

Nick picture Nick · Oct 6, 2013

I've just built CPython 2.7.5 in debug mode with Visual Studio 2012 Express (free).

I documented the process via wiki page: https://wiki.python.org/moin/VS2012