在x86_64上安装gevent失败:“未定义的符号:evhttp_accept_socket”
我正在一个全新的 EC2 CentOS 5.3 64位 系统上安装 gevent。
因为 yum 中提供的 libevent 版本太旧,无法满足另一个软件包(beanstalkd)的需求,所以我手动编译并安装了 libevent-1.4.13-stable
,使用了以下命令:
./configure --prefix=/usr && make && make install
这是安装 gevent 时的输出信息:
[gevent-0.12.2]# python setup.py build --libevent /usr/lib
Using libevent 1.4.13-stable: libevent.so
running build
running build_py
running build_ext
Linking /usr/src/gevent-0.12.2/build/lib.linux-x86_64-2.6/gevent/core.so to
/usr/src/gevent-0.12.2/gevent/core.so
[gevent-0.12.2]# cd /path/to/my/project
[project]# python myscript.py
Traceback (most recent call last):
File "myscript.py", line 9, in <module>
from gevent.wsgi import WSGIServer as GeventServer
File "/usr/lib/python2.6/site-packages/gevent/__init__.py", line 32, in <module>
from gevent.core import reinit
ImportError: /usr/lib/python2.6/site-packages/gevent/core.so: undefined symbol: evhttp_accept_socket
我在本地的 VirtualBox 实例(32位)上完全按照相同的步骤操作,没有看到任何错误。
我该如何解决这个问题呢?
1 个回答
3
最简单的解决办法是克隆这个 git 仓库,切换到 wip-all
分支,然后运行 python setup.py build_libevent build install
这个命令,这样就可以把 libevent 静态链接到 gevent 上并进行构建。
# git clone http://github.com/schmir/gevent.git
# cd gevent
# git branch -a
* upstream
origin/HEAD
origin/close-socket-cancel-event
origin/pywsgi-without-basehttpserver
origin/upstream
origin/wip-all
origin/wip-setup-config
# git checkout origin/wip-all
# python setup.py build_libevent build install
更多信息可以在 这里找到。