Search code examples
pythoncygwinpipgeventlibevent

How do I build gevent in python under cygwin?


I want to use python consistently in a variety of environments. One of those environments is cygwin. One of the components I want to use is gevent (http://www.gevent.org/intro.html). Under cygwin, I have python 2.7 running (built locally, with the one line change described here, which is required for it to build: http://www.gossamer-threads.com/lists/python/python/976956).

gevent requires libevent (http://libevent.org/).

libevent seems to build just fine under cygwin (./configure && make && make install).

However, when building gevent (pip install gevent), it fails because libevent built static libraries (such as /usr/local/lib/libevent.a) and the gevent build wants shared libraries. Thus:

gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.7.13-i686-2.7/gevent/core.o -L/usr/local/lib/python2.7/config -levent -lpython2.7 -o build/lib.cygwin-1.7.13-i686-2.7/gevent/core.dll

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -levent

Meanwhile, if I try to get gevent to link statically (CFLAGS='-static' pip install gevent), -levent still fails, along with numerous warnings about how dereferencing type-punned pointer will break strict-aliasing rules and some additional ld failures:

gevent/core.c:21835: warning: dereferencing type-punned pointer will break strict-aliasing rules

....
gevent/core.c:21836: warning: dereferencing type-punned pointer will break strict-aliasing rules

gcc -shared -Wl,--enable-auto-image-base -static build/temp.cygwin-1.7.13-i686-2.7/gevent/core.o -L/usr/local/lib/python2.7/config -levent -lpython2.7 -o build/lib.cygwin-1.7.13-i686-2.7/gevent/core.dll

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -levent

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lpython2.7

... so...

I think I need to tell libevent to build .dll instead of .a, but libevent's Makefile does not actually have a .a target, and it's not clear to me how the abstractions being used would have to change to accomplish this.

So, taking a step back: how do I install gevent under python 2.7 under cygwin?


Solution

  • Can you try a beta release from http://code.google.com/p/gevent/downloads/list ?

    It does not require any external dependencies.