Linux下编译LibCURL

编译环境
操作系统: Red Hat Enterprise Linux Server release 5.4 64-bit
编译工具: gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
 
 
1.    下载libssh2库
 
将libssh2-1.4.2.tar.gz上传至/home目录下
 
 
2.    编译安装libssh2库
 
$ cd /home
$ tar -zxvf libssh2-1.4.2.tar.gz
$ cd libssh2-1.4.2
$ ./configure --with-libssl-prefix=/usr/local/openssl
$ make && make install && make clean
 
注:如果出现:configure: error: cannot find OpenSSL or Libgcrypt 错误
 
修改为:./configure --with-libssl-prefix=/usr/local/openssl CPPFLAGS="-I/usr/local/openssl/include" LDFLAGS="-L/usr/local/openssl/lib"
 
 
3.    下载LibCURL
 
地址:http://curl.haxx.se/download.html
以curl-7.27.0.tar.gz包为例,将curl-7.27.0.tar.gz上传至/home目录下
 
 
4.     解压LibCURL
 
$ cd /home
$ tar -zxvf curl-7.27.0.tar.gz
$ cd curl-7.27.0
 
 
5.    编译并安装
 
编译
$ ./configure --with-ssl=/usr/local/openssl --with-libssh2=/usr/local --with-zlib
$ make && make install
 
清理编译时的中间文件
$ make clean
 
 
6.    使用
 
在/usr/local/lib中存放的生成的LibCURL库libcurl.a,可以直接用来参与静态编译





  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值