#165 closed defect (fixed)
windows: easy_install fails without even if mingw is available
Reported by: | ThurnerRupert | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.6 |
Component: | Serialization | Version: | devel |
Keywords: | _speedups windows | Cc: |
Description
there is two problems:
- out of the box install fails with
C:\tmp>easy_install http://svn.edgewall.org/repos/genshi/trunk/ Downloading http://svn.edgewall.org/repos/genshi/trunk/ Doing subversion checkout from http://svn.edgewall.org/repos/genshi/trunk/ to c:\data\profiles\a867180\locals~1\temp\easy_install-eubo20\trunk svn: PROPFIND request failed on '/repos/edgewall/tools/doc' svn: PROPFIND of '/repos/edgewall/tools/doc': 403 Forbidden (https://svn.edgewall.org) Processing trunk Running setup.py -q bdist_egg --dist-dir c:\data\profiles\a867180\locals~1\temp\easy_install-eubo20\trunk\egg-dist-tmp-vm2flo warning: no files found matching 'doc\api\*.*' warning: no files found matching 'doc\*.html' error: Setup script exited with error: Python was built with Visual Studio 2003; extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32, by passing "-c mingw32" to setup.py. C:\tmp>easy_install -c mingw32 http://svn.edgewall.org/repos/genshi/trunk/ usage: easy_install-script.py [options] requirement_or_url ... or: easy_install-script.py --help error: option -c not recognized
- if you do it in steps with mingw it fails also
- svn co http://svn.edgewall.org/repos/genshi/trunk/ genshi-trunk
- add the following to setup.cfg:
[build] compiler=mingw32
creating build\temp.win32-2.5\Release\genshi c:\apps\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ic:\apps\python25\include -Ic:\apps\python25\PC -c genshi/_speedups.c -o build\temp.win32-2.5\Release\genshi\_speedups.o genshi/_speedups.c:535: warning: 'MarkupType' defined locally after being referenced with dllimport linkage writing build\temp.win32-2.5\Release\genshi\_speedups.def c:\apps\mingw\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.5\Release\genshi\_speedups.o build\temp.win32-2.5\Release\genshi\_speedups.def -Lc:\apps\python25\libs -Lc :\apps\python25\PCBuild -lpython25 -lmsvcr71 -o build\lib.win32-2.5\genshi\_speedups.pyd build\temp.win32-2.5\Release\genshi\_speedups.o:_speedups.c:(.text+0x179): undefined reference to `_imp__MarkupType' build\temp.win32-2.5\Release\genshi\_speedups.o:_speedups.c:(.text+0x180): undefined reference to `_imp__MarkupType' build\temp.win32-2.5\Release\genshi\_speedups.o:_speedups.c:(.text+0x260): undefined reference to `_imp__MarkupType' build\temp.win32-2.5\Release\genshi\_speedups.o:_speedups.c:(.text+0x408): undefined reference to `_imp__MarkupType' build\temp.win32-2.5\Release\genshi\_speedups.o:_speedups.c:(.text+0x7a9): undefined reference to `_imp__MarkupType' build\temp.win32-2.5\Release\genshi\_speedups.o:_speedups.c:(.text+0x7f4): more undefined references to `_imp__MarkupType' follow collect2: ld returned 1 exit status ********************************************************************** WARNING: An optional C extension could not be compiled, speedups will not be available. ********************************************************************** creating build\bdist.win32
Attachments (3)
Change History (14)
comment:1 Changed 17 years ago by cmlenz
- Milestone 0.5 deleted
comment:2 Changed 17 years ago by athomas
#174 is a duplicate of this ticket.
comment:3 follow-up: ↓ 5 Changed 17 years ago by athomas
- Resolution set to fixed
- Status changed from new to closed
Fixed in r789.
comment:4 Changed 17 years ago by anonymous
- Resolution fixed deleted
- Status changed from closed to reopened
I believe this ticket was closed mistakenly. The defect is that the
undefined reference to `_imp__MarkupType'
errors are generated when attempting to compile using the mingw32 compiler on windows. The fix referenced in r789 doesn't fix this problem. This should probably be reopened in case someone can figure out the problem and fix it.
comment:5 in reply to: ↑ 3 Changed 17 years ago by njriley+genshi.edgewall.org@…
Changed 17 years ago by njriley+genshi.edgewall.org@…
display exception and remove warnings if setuptools absent
comment:6 follow-up: ↓ 8 Changed 17 years ago by Shun-ichi Goto <shunichi.goto@…>
I think this compiler error comes from a misuse of PyAPI_DATA. By according to pyport.h, PyAPI_DATA is a linkage spec of the data in python core. So the following patch is enough for both MinGW and MSVC.
-
genshi/_speedups.c
diff -r 7f0445736fde genshi/_speedups.c
a b 43 43 44 44 /* Markup class */ 45 45 46 Py API_DATA(PyTypeObject) MarkupType;46 PyTypeObject MarkupType; /* declared later */ 47 47 48 48 PyDoc_STRVAR(Markup__doc__, 49 49 "Marks a string as being safe for inclusion in HTML/XML output without\n\
comment:7 Changed 16 years ago by cboos
- Milestone set to 0.5.2
I too would like to get the actual exception message when failing to build the extension.
Here's a patch a bit similar to the attachment:genshi.diff, but simpler:
-
setup.py
40 40 def run(self): 41 41 try: 42 42 build_ext.run(self) 43 except DistutilsPlatformError :44 self._unavailable( )43 except DistutilsPlatformError, e: 44 self._unavailable(e) 45 45 46 46 def build_extension(self, ext): 47 47 try: … … 49 49 global _speedup_available 50 50 _speedup_available = True 51 51 except CCompilerError, x: 52 self._unavailable( )52 self._unavailable(x) 53 53 54 def _unavailable(self ):54 def _unavailable(self, exc): 55 55 print '*' * 70 56 56 print """WARNING: 57 57 An optional C extension could not be compiled, speedups will not be 58 58 available.""" 59 59 print '*' * 70 60 print exc 60 61 61 62 62 63 if Feature:
comment:8 in reply to: ↑ 6 Changed 16 years ago by cboos
- Component changed from General to Serialization
- Keywords _speedups windows added
Replying to Shun-ichi Goto <shunichi.goto@…>:
I think this compiler error comes from a misuse of PyAPI_DATA. By according to pyport.h, PyAPI_DATA is a linkage spec of the data in python core. So the following patch is enough for both MinGW and MSVC.
I confirm that this patch removes a warning. See attachment:_speedups_no_warnings_x64-r988.diff which includes that change plus two more that silence two "conversion from 'Py_ssize_t' to 'int'" warnings I had on Windows x64.
comment:9 follow-up: ↓ 10 Changed 16 years ago by cmlenz
- Resolution set to fixed
- Status changed from reopened to closed
I've applied these patches in [995]. Thanks! Let me know if there's still anything missing or wrong.
comment:10 in reply to: ↑ 9 Changed 16 years ago by cboos
Replying to cmlenz:
Let me know if there's still anything missing or wrong.
Well, just for the record there's still a linker warning, but I'm not sure how to fix it (and it's probably not worth the trouble).
_speedups.obj : warning LNK4197: export 'init_speedups' specified multiple times; using first specification
This is because there's both an /EXPORT:init_speedups given to the linker and a PyMODINIT_FUNC declspec for the function itself. Replace the latter by void makes the warning go away, but maybe there are compiler /platforms which really need that macro, so probably best is to do nothing, as the warning is harmless.
comment:11 Changed 15 years ago by cmlenz
- Milestone changed from 0.5.2 to 0.6
Milestone 0.5.2 deleted
I don't really know what to do with this one as I don't have Windows with the mingw32 toolchain available. I'll be providing binaries built with Visual Studio 2003 with releases. If that's not enough and you need to be able to build with mingw32, I'd gladly accept patches!