如何在cygwin下用python构建gevent?

2024-09-30 08:19:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在各种环境中一致地使用python。cygwin就是其中之一。我想使用的组件之一是gevent(http://www.gevent.org/intro.html). 在cygwin下,我运行了python2.7(在本地构建,这里只做了一行修改,这是它构建:http://www.gossamer-threads.com/lists/python/python/976956)所必需的。在

gevent需要libevent(http://libevent.org/). 在

在cygwin(./configure&make&make&makeinstall)下,libevent似乎构建得很好。在

但是,在构建gevent(pip install gevent)时,它会失败,因为libevent构建了静态库(例如/usr/local/lib/libevent.a),而gevent构建需要共享库。因此:

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

同时,如果我试图让gevent静态链接(CFLAGS='-static'pip install gevent),-levent仍然失败,同时还有许多关于取消引用类型punned指针将如何打破严格的别名规则和一些额外的ld失败的警告:

gevent/core.c:21835:警告:取消引用类型punned指针将违反严格的别名规则

^{pr2}$

。。。所以。。。在

我想我需要告诉libevent构建.dll而不是.a,但是libevent的Makefile实际上没有.a目标,而且我不清楚所使用的抽象将如何改变才能实现这一点。在

那么,退一步:如何在cygwin下的Python2.7下安装gevent?在


Tags: installpiporgcorehttpmakelibusr

热门问题