一、代码准备
gunzip curl-7.37.1.tar.gz——解压
tar xvf curl-7.37.1.tar——解包
二、编译
32位编译
1)configure
2)make
至少在我的平台上没出现什么问题
在lib/.libs目录下找到libcurl.a和libcurl.so.4,如果需要,再拷贝libcurl.so.4到libcurl.so即可
在include/curl目录下,获取必要的头文件。(注意一点,不同平台下,配置出来的curlbuild.h是不同的)
64位编译
1)configure过程失败如下,
checking run-time libs availability... failed
configure: error: one or more libs available at link-time are not available run-time. Libs used at link-time: -lidn -lssh2 -lssl -lcrypto -lssl -lcrypto -ldl -lz -lldap -lz -lrt
找了一下,这些库都分别在/usr/lib64和
/usr/local/lib
目录下(
libssh2.so在
/usr/local/lib
目录下,其他的在
/usr/lib64),
export LD_LIBRARY_PATH=/usr/local/lib:
/usr/lib64:
$LD_LIBRARY_PATH
再次configure,成功!显示各个模块的支持情况如下
curl version: 7.37.1
Host setup: x86_64-unknown-linux-gnu
Install prefix: /usr/local
Compiler: gcc
SSL support: enabled (OpenSSL)
SSH support: enabled (libSSH2)
zlib support: enabled
GSS-API support: no (--with-gssapi)
SPNEGO support: no (--with-spnego)
TLS-SRP support: no (--enable-tls-srp)
resolver: default (--enable-ares / --enable-threaded-resolver)
ipv6 support: enabled
IDN support: enabled
Build libcurl: Shared=yes, Static=yes
Built-in manual: enabled
--libcurl option: enabled (--disable-libcurl-option)
Verbose errors: enabled (--disable-verbose)
SSPI support: no (--enable-sspi)
ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt
ca cert path: no
LDAP support: enabled (OpenLDAP)
LDAPS support: enabled
RTSP support: enabled
RTMP support: no (--with-librtmp)
metalink support: no (--with-libmetalink)
HTTP2 support: disabled (--with-nghttp2)
Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SCP SFTP SMTP SMTPS TELNET TFTP
2)make
大功告成。