pycurl编译安装(CentOS5)

原文地址:http://xpython.lofter.com/post/15f5d8_563afd


pycurl编译安装(CentOS5)

前提:用yum进行curl的安装遇到依赖关系问题,

yum clean dbcache
yum clean all
yum update

仍然有依赖关系,而后进行手动编译依赖关系包。
如果yum能够直接搞定当然最好。
过程简录:
动态库的问题就不记了,各种连接。
主要两个坎:
#error "Need libcurl version 7.19.0 or greater to compile pycurl."

需要升级libcurl

查看当前版本:
# curl-config --version
libcurl 7.15.0

接下来参考http://blog.linuxhonker.com/index.php/2012/08/%E7%BC%96%E8%AF%91python%E6%8B%93%E5%B1%95pycurl%E6%8A%9Berror-command-gcc-failed-with-exit-status-1/

安装curl-7.21.4
之前安装了curl-7.30.x,爆出很多未定义符号,依赖关系:curl->libcurl->libssh2
因为curl依赖libssh2,所以curl版本越高意味着依赖越多,
之前因为这个问题折腾好久。

另外安装libcurl我使用yum,因为yum可以帮你解决libssh2依赖关系,但是libssh2也有需要解决的问题,编译安装curl-30时出现许多未定义符号就因为libssh2版本过低,遇到第二个坎:

/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/libcurl.so: undefined reference to `libssh2_knownhost_init'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/libcurl.so: undefined reference to `libssh2_knownhost_free'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/libcurl.so: undefined reference to `libssh2_knownhost_readfile'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/libcurl.so: undefined reference to `libssh2_knownhost_check'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/libcurl.so: undefined reference to `libssh2_session_hostkey'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/libcurl.so: undefined reference to `libssh2_knownhost_writefile'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/libcurl.so: undefined reference to `libssh2_knownhost_add'

接下来参考:
https://bugzilla.redhat.com/show_bug.cgi?id=579619

这里说的很清楚,不同版本的curl和不同版本的libssh2可能会出现这种情况,最好都是最终版本(我用curl-30有问题)。
最后我将libssh2更新到libssh2-1.4.3.tar.gz,编译安装。

步骤:

1. # yum libcurl7-7.29.0-2.ius.el5.x86_64.rpm(此处会要求安装libssh2,先安装稍后升级)2. # wget http://curl.haxx.se/download/curl-7.21.4.tar.gz
3. # cd curl-7.21.4
4. # ./configure; make; make install
5. # rpm -e libssh2
6. # cd ..; cd libssh2-1.4.3
7. # ./configure; make; make install
8. # cd ..; cd pycurl; python setup.py install
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值