Opened 4 years ago

Closed 3 years ago

#4612 defect closed fixed (fixed)

build Twisted on 64-bit Windows with mingw

Reported by: carsonmyers Owned by:
Priority: normal Milestone: Python-2.7
Component: core Keywords: build, win32, win64
Cc: davidsarah, techtonik@…, zooko@…, thijs Branch:
Author: Launchpad Bug:

Description

Like the title says, I'm having trouble buidling twisted 10.1. Previously I just used the windows installer but there isn't a python 2.7 installer as of now.

Firstly, I get these messages:

C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c conftest.c -o conftest.o
conftest.c:1:21: rpc/rpc.h: No such file or directory
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python
27\include -IC:\Python27\PC -c conftest.c -o conftest.o
conftest.c:1:23: sys/epoll.h: No such file or directory

From what I have gathered from looking around, conftest failures don't fail the whole build, which they didn't. Are they important in any way though?

I then got all of this, which did fail the build:

C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 -IC:\Python27\include -IC:\Python27\PC -c twisted/protocols/_c_urlarg.c -o build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o
writing build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.def
C:\MinGW\bin\gcc.exe -mno-cygwin -shared -s build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.def -LC:\Python27\libs -LC:\Python27\PCbuild\amd64 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\twisted\protocols\_c_urlarg.pyd
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x5a): undefined reference to `_imp__PyArg_ParseTupleAndKeywords'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x82): undefined reference to `_imp__PyString_FromStringAndSize'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x9d): undefined reference to `_imp__PyString_FromStringAndSize'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0xb9): undefined reference to `_imp__PyString_AsString'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x1f1): undefined reference to `_imp___PyString_Resize'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x232): undefined reference to `_imp__Py_InitModule4'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x23b): undefined reference to `_imp__PyModule_GetDict'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x24a): undefined reference to `_imp__PyExc_Exception'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x25d): undefined reference to `_imp__PyErr_NewException'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x277): undefined reference to `_imp__PyDict_SetItemString'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x2d9): undefined reference to `_imp__PyErr_Occurred'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x2e3): undefined reference to `_imp__PyErr_Print'
build\temp.win-amd64-2.7\Release\twisted\protocols\_c_urlarg.o:_c_urlarg.c:(.text+0x2f0): undefined reference to `_imp__Py_FatalError'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

It seems it can't find references to python components? I have both py26 and py27 installed on my machine, don't know if that makes a difference.

Change History (15)

comment:1 follow-up: Changed 4 years ago by exarkun

It appears you're using cygwin. It might help if you gave the version information for that. However, note that there are other cygwin-related build issues which have been open for quite some time and remain unfixed because few developers have a cygwin setup. So if you'd really like this fixed, you may need to figure out what's going wrong yourself and supply a patch.

comment:2 in reply to: ↑ 1 Changed 4 years ago by carsonmyers

Replying to exarkun:

It appears you're using cygwin. It might help if you gave the version information for that. However, note that there are other cygwin-related build issues which have been open for quite some time and remain unfixed because few developers have a cygwin setup. So if you'd really like this fixed, you may need to figure out what's going wrong yourself and supply a patch.

I don't know much about cygwin. All I did was download MinGW and write a distutils.conf file containing the following

[build]
compiler=mingw32

comment:3 follow-up: Changed 4 years ago by exarkun

  • Keywords win32 added

I don't know much about cygwin. All I did was download MinGW and write a distutils.conf file containing the following

Ah. Okay, that's a little less unsupported than using cygwin. But only a little. You have to make sure that Python 2.7 on Windows 7 actually supports using mingw to build extension modules. This varies from Python version to Python version and is outside of Twisted's control. It may be that Python 2.7 on Windows 7 no longer supports mingw-built extensions, in which case there's probably no reasonable way for Twisted to fix this case. On the other hand, it might be supported just fine; I don't know what the current state is.

comment:4 in reply to: ↑ 3 Changed 4 years ago by carsonmyers

Replying to exarkun:

I don't know much about cygwin. All I did was download MinGW and write a distutils.conf file containing the following

Ah. Okay, that's a little less unsupported than using cygwin. But only a little. You have to make sure that Python 2.7 on Windows 7 actually supports using mingw to build extension modules. This varies from Python version to Python version and is outside of Twisted's control. It may be that Python 2.7 on Windows 7 no longer supports mingw-built extensions, in which case there's probably no reasonable way for Twisted to fix this case. On the other hand, it might be supported just fine; I don't know what the current state is.

I see, that makes sense. I just got mingw because I am familiar with it, what do you suggest I use to get twisted to build? will I need visual studio? Come to think of it, I have a 64 bit version of python and was using a 32 bit compiler to build twisted.

comment:5 follow-ups: Changed 4 years ago by davidsarah

  • Cc davidsarah added

A user of Tahoe-LAFS also hit this problem with Python 2.6 on Windows 7 64-bit. The compilation failures look identical to Python 2.7. Zope.interface also fails to compile in the same way.

(As far as I understand, there is no separate version of MinGW for 64-bit Windows.)

Shouldn't twisted fall back to building without extension modules if gcc fails?

comment:6 in reply to: ↑ 5 Changed 4 years ago by davidsarah

  • Keywords win64 added

Replying to davidsarah:

(As far as I understand, there is no separate version of MinGW for 64-bit Windows.)

It appears that MinGW can only currently build 32-bit modules. TDM-GCC is a fork of MinGW that can build 64-bit modules, which I think is probably necessary for this to have any chance of working.

Shouldn't twisted fall back to building without extension modules if gcc fails?

Ah, that is #3586.

comment:7 in reply to: ↑ 5 Changed 4 years ago by carsonmyers

Replying to davidsarah:

A user of Tahoe-LAFS also hit this problem with Python 2.6 on Windows 7 64-bit. The compilation failures look identical to Python 2.7. Zope.interface also fails to compile in the same way.

(As far as I understand, there is no separate version of MinGW for 64-bit Windows.)

Shouldn't twisted fall back to building without extension modules if gcc fails?

I have since downloaded Visual Studio 2008 (which I have read is the required version of visual studio for python builds, for some reason or another) and the errors are identical to the ones produced by MinGW (more or less, anyway). If Zope.Interface fails to compile with the same messages, perhaps this is a bug in distutils for 64 bit C extensions?

comment:8 Changed 4 years ago by <automation>

  • Owner glyph deleted

comment:9 Changed 4 years ago by techtonik

  • Cc techtonik@… added

comment:10 Changed 3 years ago by zooko

  • Cc zooko@… added
  • Summary changed from Installing twisted 10.1 for python 2.7 on windows 7 64 bit -- build errors to Installing twisted 10.1 for python 2.7 on windows 7 64 bit with mingw -- build errors

comment:11 Changed 3 years ago by zooko

  • Summary changed from Installing twisted 10.1 for python 2.7 on windows 7 64 bit with mingw -- build errors to build Twisted on 64-bit Windows with mingw

comment:12 follow-up: Changed 3 years ago by exarkun

As far as I know, Twisted builds fine on Windows 7, 64 bit. You do have to use the correct compiler, though. That's MSVC2008 or something with a compatible ABI.

comment:13 in reply to: ↑ 12 Changed 3 years ago by thijs

  • Cc thijs added

Replying to exarkun:

As far as I know, Twisted builds fine on Windows 7, 64 bit. You do have to use the correct compiler, though. That's MSVC2008 or something with a compatible ABI.

That should be documented.

comment:14 Changed 3 years ago by exarkun

That should be documented.

What should be? MSVC2008? Certainly. Please file a bug on http://bugs.python.org/ for that.

comment:15 Changed 3 years ago by exarkun

  • Resolution set to fixed
  • Status changed from new to closed

As I understand it, this is really just an issue with the Windows tool chain. If you get it all set up properly, then things work. So, resolving.

Note: See TracTickets for help on using tickets.