Issue957198
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2004-05-20 03:36 by connelly, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (4) | |||
---|---|---|---|
msg20847 - (view) | Author: Connelly (connelly) | Date: 2004-05-20 03:36 | |
I am asking you to distribute libpython23.a with Python. This is a library built by the Mingw compiler (www.mingw.org). When this file is present, it greatly simplifies the process of installing a C/C++ extension. The below document explains how make this library, and install a C/C++ extension with the Mingw compiler. Currently, a library is provided for the proprietary MSVC++ compiler (python23.lib), but not the open source Mingw compiler. Normally, one uses the following procedure to build and install a C/C++ extension: python setup.py build --compiler=your_compiler python setup.py install For Python 2.3.3 on Windows, with the Mingw (Minimalist GNU) compiler, the following steps must be taken: 1. Find your Mingw bin directory. Copy gcc.exe to cc.exe. 2. Get PExports from either of: http://sebsauvage.net/python/pexports-0.42h.zip http://starship.python.net/crew/kernr/mingw32/pexports-0.42h.zip Extract pexports.exe to your Mingw bin directory. 3. Find pythonxx.dll. It should be in your main Python directory. Do the following: pexports python23.dll > python23.def dlltool --dllname python23.dll --def python23.def --output-lib libpython23.a 4. Copy libpythonxx.a to \python\libs. 5. Patch distutils. Locate \python\lib\distutils\msvccompiler.py, open it, and find the following lines (around line 211): if len (self.__paths) == 0: raise DistutilsPlatformError, \ ("Python was built with version %s of Visual Studio, " "and extensions need to be built with the same " "version of the compiler, but it isn't installed." % self.__version) Delete these. 6. Move back to the directory of your extension. Do the following: python setup.py build --compiler=mingw32 python setup.py install Ideally, only step 6 should be required to install an extension. I submitted the patch for step 5 to python.sourceforge.net. Steps 2-4 can be avoided if the libpythonxx.a file is distributed with Python. Step 1 can probably be avoided with another patch. This document is based on http://sebsauvage.net/python/mingw.html, which was written for Mingw + Python 2.2. Thanks, Connelly |
|||
msg20848 - (view) | Author: Andrew I MacIntyre (aimacintyre) * | Date: 2004-05-23 08:11 | |
Logged In: YES user_id=250749 While older releases of MinGW certainly required this library fiddling, such as the MingW 1.1 pkg with gcc 2.95, I had been under the impression that recent versions could quite happily use the MSVC python23.lib. If you have tried this and had it fail, which version of MinGW? Using the --compiler=mingw32 build option should not require patching Distutils, though you probably have to use it for both build and install invocations. You can just issue to the install command (with the --compiler switch) which will both build and install the extention. |
|||
msg20849 - (view) | Author: Connelly (connelly) | Date: 2004-05-25 18:23 | |
Logged In: YES user_id=1039782 I am using Mingw 3.1.0-1, released on Sep 15, 2003. It is the 'current' release of Mingw. I'm using Python 2.3.3. Issuing python setup.py install --compiler=mingw32 causes an error. I'm not sure which error -- I'll post it here tomorrow when I'm at the right machine. So I left off the --compiler option for the install step. This produced the error "Python was built with version %s of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed." This error is not produced if VC++ is installed. Thus you need to find a machine WITHOUT VC++ to test out the build process with Mingw32. I don't know how to tell MinGW to use python23.lib. Perhaps this is all the result of not passing the right flag to 'python setup.py install'? After all, it's using msvccompiler.py, which seems suspicious. I don't think I'm the only one having this problem. See: http://randomthoughts.vandorp.ca/WK/blog/758?t=item |
|||
msg20850 - (view) | Author: Thomas Heller (theller) * | Date: 2004-06-04 16:02 | |
Logged In: YES user_id=11105 python23.lib (from MSVC) is provided with the Windows installer because Python is built with that compiler. I refuse to distribute libpython23.a for MingW with the official installer mainly because I cannot test it, and I'm not clear if there are issues with different mingw versions. Wouldn't it be a better idea to provide a distutils patch which will build libpython23.a with mingw itself, if the library is not found? |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:04 | admin | set | github: 40273 |
2004-05-20 03:36:16 | connelly | create |