Opened 5 years ago

Closed 18 months ago

Last modified 18 months ago

#6540 enhancement closed duplicate (duplicate)

Support Twisted installation on OS X 10.8 using Python 3 and pip

Reported by: Hynek Schlawack Owned by: Ihar Hrachyshka
Priority: normal Milestone:
Component: core Keywords:
Cc: Hynek Schlawack, Ihar Hrachyshka Branch:
Author:

Description

Currently it’s impossible to install twisted using pip because of two compilation problems:

clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/readline/include -I/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c conftest.c -o conftest.o

conftest.c:1:10: fatal error: 'sys/epoll.h' file not found

#include <sys/epoll.h>

         ^

1 error generated.

and


clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/readline/include -I/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c twisted/python/sendmsg.c -o build/temp.macosx-10.8-x86_64-3.3/twisted/python/sendmsg.o

twisted/python/sendmsg.c:126:14: warning: implicit declaration of function 'Py_InitModule3' is invalid in C99 [-Wimplicit-function-declaration]

    module = Py_InitModule3("sendmsg", sendmsg_methods, sendmsg_doc);

             ^

twisted/python/sendmsg.c:126:12: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]

    module = Py_InitModule3("sendmsg", sendmsg_methods, sendmsg_doc);

           ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

twisted/python/sendmsg.c:129:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]

        return;

        ^

twisted/python/sendmsg.c:138:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]

        return;

        ^

twisted/python/sendmsg.c:145:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]

        return;

        ^

twisted/python/sendmsg.c:159:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]

        return;

        ^

twisted/python/sendmsg.c:165:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]

        return;

        ^

twisted/python/sendmsg.c:170:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]

        return;

        ^

2 warnings and 6 errors generated.

error: command 'clang' failed with exit status 1

python3 setup3.py install works fine though both with 13.0.0 and release.

I’ll attach the full install log to the ticket.

Attachments (3)

pip-install-twisted-python-3.txt (89.2 KB) - added by Hynek Schlawack 5 years ago.
Full error log from attempting to install Twisted on OS X with Python 3.3
fix-module-init-interface-p3k.patch (3.4 KB) - added by Ihar Hrachyshka 4 years ago.
Fixed compilation errors on python3.x (handle changes in module init face)
fix-module-init-interface-p3k.2.patch (3.5 KB) - added by Ihar Hrachyshka 4 years ago.
In previous upload, missed return part in p3k module init function implementation

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by Hynek Schlawack

Cc: Hynek Schlawack added

Changed 5 years ago by Hynek Schlawack

Full error log from attempting to install Twisted on OS X with Python 3.3

comment:2 Changed 5 years ago by Jean-Paul Calderone

Summary: Twisted is not pip-installable on OS X due to compiler errorsSupport Twisted installation on OS X 10.8 using Python 3 and pip
Type: defectenhancement

comment:3 Changed 5 years ago by Jean-Paul Calderone

Note that unfortunately the project is currently without an OS X 10.8 build environment - please see <http://twistedmatrix.com/pipermail/twisted-python/2013-May/027003.html>.

comment:4 Changed 4 years ago by Ihar Hrachyshka

Cc: Ihar Hrachyshka added
Owner: set to Ihar Hrachyshka
Status: newassigned

Changed 4 years ago by Ihar Hrachyshka

Fixed compilation errors on python3.x (handle changes in module init face)

Changed 4 years ago by Ihar Hrachyshka

In previous upload, missed return part in p3k module init function implementation

comment:5 Changed 4 years ago by Ihar Hrachyshka

Keywords: review added
Owner: Ihar Hrachyshka deleted
Status: assignednew

comment:6 Changed 4 years ago by Jean-Paul Calderone

Keywords: review removed

Thanks for your work on this.

  1. Ideally, we would test this feature on <http://buildbot.twistedmatrix.com/>. I'm not sure we actually have the resources available to do so, though.
  2. There are some logical changes made to several extension modules here. It seems like it would produce better results to actually *port* those modules - in particular, to make their test suites run and complete successfully. Compilation failures (like test failures) are a good way to identify unported code - silencing the errors without being sure the code works on Python 3 is sort of like sweeping the problem under the rug.
  3. The patch includes a change to raiser.c which is Cython-generated source code. It should never be edited directly because as soon as Cython is run on the original source file (raiser.pyx) the manual changes to raiser.c will be overwritten and lost.

I suggest filing one ticket for porting sendmsg.c, one ticket for porting portmap.c, and one ticket for porting (or most likely, regenerating with a modern version of Cython) raiser.c. Once each of those is resolved (presumably starting with the relevant pieces of the patch attached here), this ticket may be complete as well (apart from setting up necessary BuildBot pieces).

Thanks again.

comment:7 Changed 4 years ago by Ihar Hrachyshka

Owner: set to Ihar Hrachyshka
Status: newassigned

comment:8 Changed 18 months ago by Craig Rodrigues

Resolution: duplicate
Status: assignedclosed

In 6539, setup.py was modified to call setup3.py, so this isn't a problem any more.

comment:9 Changed 18 months ago by Craig Rodrigues

Note: See TracTickets for help on using tickets.