Edgewall Software

Opened 17 years ago

Closed 16 years ago

Last modified 15 years ago

#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:

  1. 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
    
  2. if you do it in steps with mingw it fails also
    1. svn co http://svn.edgewall.org/repos/genshi/trunk/ genshi-trunk
    2. 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)

windows-vs-skip.diff (1.1 KB) - added by didley@… 17 years ago.
Don't abort completely if a compiler is not available
genshi.diff (3.8 KB) - added by njriley+genshi.edgewall.org@… 17 years ago.
display exception and remove warnings if setuptools absent
_speedups_no_warnings_x64-r988.diff (913 bytes) - added by cboos 16 years ago.
Shun-ichi goto's patch from comment:6 + two more warning suppressed

Download all attachments as: .zip

Change History (14)

comment:1 Changed 17 years ago by cmlenz

  • Milestone 0.5 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!

Changed 17 years ago by didley@…

Don't abort completely if a compiler is not available

comment:2 Changed 17 years ago by athomas

#174 is a duplicate of this ticket.

comment:3 follow-up: 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@…

Replying to athomas:

Fixed in r789.

No it isn't; that fix still fails to display the exception.

Try the attached patch instead; it also removes some warnings when not running with setuptools installed. Tested with win32 and Jython (which has no C compiler, therefore compilation always fails).

Changed 17 years ago by njriley+genshi.edgewall.org@…

display exception and remove warnings if setuptools absent

comment:6 follow-up: 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  
    4343
    4444/* Markup class */
    4545
    46 PyAPI_DATA(PyTypeObject) MarkupType;
     46PyTypeObject MarkupType;                        /* declared later */
    4747
    4848PyDoc_STRVAR(Markup__doc__,
    4949"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

     
    4040    def run(self):
    4141        try:
    4242            build_ext.run(self)
    43         except DistutilsPlatformError:
    44             self._unavailable()
     43        except DistutilsPlatformError, e:
     44            self._unavailable(e)
    4545
    4646    def build_extension(self, ext):
    4747        try:
     
    4949            global _speedup_available
    5050            _speedup_available = True
    5151        except CCompilerError, x:
    52             self._unavailable()
     52            self._unavailable(x)
    5353
    54     def _unavailable(self):
     54    def _unavailable(self, exc):
    5555        print '*' * 70
    5656        print """WARNING:
    5757An optional C extension could not be compiled, speedups will not be
    5858available."""
    5959        print '*' * 70
     60        print exc
    6061
    6162
    6263if 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.

Changed 16 years ago by cboos

Shun-ichi goto's patch from comment:6 + two more warning suppressed

comment:9 follow-up: 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

Note: See TracTickets for help on using tickets.