On 5 June 2015 at 02:28, MRAB <pyt...@mrabarnett.plus.com> wrote: > For reference, here's how I can build the regex module on Windows 8.1, > 64-bit, using only MinGW64. > > For Python 3.5, I can link against "python35.dll", but for earlier > versions, including Python 2.7, I need "libpython.a". > > I have built regex module for all of the 16 supported versions of > Python (2.5-2.7, 3.1-3.5, 64-bit and 32-bit) and they have all passed > the tests. > > > rem For Python 3.5, 64-bit. > rem Can link against the Python DLL. > > rem Compile > "C:\MinGW64\bin\gcc.exe" -mdll -m64 -DMS_WIN64 -O2 -Wall -Wsign-compare > -Wconversion -I"C:\Python35-64\include" -c > "D:\mrab-regex\source\_regex_unicode.c" -o > "D:\mrab-regex\release\3.5-64\_regex_unicode.o" > > "C:\MinGW64\bin\gcc.exe" -mdll -m64 -DMS_WIN64 -O2 -Wall -Wsign-compare > -Wconversion -I"C:\Python35-64\include" -c "D:\mrab-regex\source\_regex.c" > -o "D:\mrab-regex\release\3.5-64\_regex.o" > > rem Link > "C:\MinGW64\bin\gcc.exe" -m64 -shared -s > "D:\mrab-regex\release\3.5-64\_regex_unicode.o" > "D:\mrab-regex\release\3.5-64\_regex.o" -L"C:\Python35" -lpython35 -o > "D:\mrab-regex\release\3.5-64\_regex.pyd"
[...] Note that even if we were to ship appropriate libpython.a libraries, this would always be a totally unsupported way of building Python extensions using mingw. If you want to build extensions, whether using mingw or otherwise, you should use distutils/setuptools. To use mingw, there's the --compiler=mingw switch that allows you to choose your compiler. There are a number of open issues around distutils with mingw which may mean that currently this approach doesn't work, but getting the mingw-using community to help with fixing those issues is the *only* way we'll ever get to a point where mingw is a supported toolchain for Python. I appreciate that "just getting it to work" is a powerful motivator here, but the plethora of different ways that people use for building extensions with mingw is *precisely* why mingw has failed to remain a supported toolchain. I'd be interested to know how well using setup.py --compiler=mingw works for your project, and why you chose to go with the manual process. (Just as an aside, setup.py works prerfectly for me when building the regex package with MSVC). Paul _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com