依赖库:
yum install -y pcre pcre-devel openssl openssl-devel zlib zlib-devel
yum install -y gcc gcc-c++
curl编译,涉及openssl
https://silenceweb.cn/archives/openssl-bian-yi
启用HTTP2和http3
需要先构建nghttp x。
https://silenceweb.cn/archives/nghttp2-bian-yi
以下为编译http2
参数注意nghttp2 lib的路径
./configure --enable-debug --with-openssl --with-nghttp2=/home/download/nghttp2-1.48.0/src
configure: Configured to build curl/libcurl:
Host setup: x86_64-pc-linux-gnu
Install prefix: /usr/local
Compiler: gcc -std=gnu11
CFLAGS: -Werror-implicit-function-declaration -g -O0 -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wbad-function-cast -Wfloat-equal -Wno-multichar -Wsign-compare -Wundef -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wold-style-definition -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wno-sign-conversion -Wvla -ftree-vrp -Wdouble-promotion -Wformat=2 -Wno-system-headers -pthread
CPPFLAGS:
LDFLAGS:
LIBS: -lssl -lcrypto -lssl -lcrypto -lz
curl version: 7.84.0
SSL: enabled (OpenSSL)
SSH: no (--with-{libssh,libssh2})
zlib: enabled
brotli: no (--with-brotli)
zstd: no (--with-zstd)
GSS-API: no (--with-gssapi)
GSASL: no (libgsasl not found)
TLS-SRP: no (--enable-tls-srp)
resolver: POSIX threaded
IPv6: enabled
Unix sockets: enabled
IDN: no (--with-{libidn2,winidn})
Build libcurl: Shared=yes, Static=yes
Built-in manual: enabled
--libcurl option: enabled (--disable-libcurl-option)
Verbose errors: enabled (--disable-verbose)
Code coverage: disabled
SSPI: no (--enable-sspi)
ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt
ca cert path: no
ca fallback: no
LDAP: no (--enable-ldap / --with-ldap-lib / --with-lber-lib)
LDAPS: no (--enable-ldaps)
RTSP: enabled
RTMP: no (--with-librtmp)
PSL: no (libpsl not found)
Alt-svc: enabled (--disable-alt-svc)
Headers API: enabled (--disable-headers-api)
HSTS: enabled (--disable-hsts)
HTTP1: enabled (internal)
HTTP2: no (--with-nghttp2, --with-hyper)
HTTP3: no (--with-ngtcp2, --with-quiche --with-msh3)
ECH: no (--enable-ech)
Protocols: DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP
Features: AsynchDNS HSTS HTTPS-proxy IPv6 Largefile NTLM NTLM_WB SSL UnixSockets alt-svc libz
[root@cdn-test ~]# ldd /usr/local/bin/curl
linux-vdso.so.1 => (0x00007ffe86fd7000)
libcurl.so.4 => /usr/local/lib/libcurl.so.4 (0x00007feb05670000)
libssl.so.10 => /lib64/libssl.so.10 (0x00007feb053fe000)
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007feb04f9b000)
libz.so.1 => /lib64/libz.so.1 (0x00007feb04d85000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007feb04b69000)
libc.so.6 => /lib64/libc.so.6 (0x00007feb0479b000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007feb0454e000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007feb04265000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007feb04061000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007feb03e2e000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007feb03c2a000)
/lib64/ld-linux-x86-64.so.2 (0x00007feb058e4000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007feb03a1a000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007feb03816000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007feb035fc000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007feb033d5000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007feb03173000)
[root@cdn-test ~]#
[root@cdn-test ~]#
[root@cdn-test ~]# ldd /usr/local/lib/libcurl.so.4
linux-vdso.so.1 => (0x00007ffcb41cd000)
libssl.so.10 => /lib64/libssl.so.10 (0x00007fee3c01b000)
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fee3bbb8000)
libz.so.1 => /lib64/libz.so.1 (0x00007fee3b9a2000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fee3b786000)
libc.so.6 => /lib64/libc.so.6 (0x00007fee3b3b8000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fee3b16b000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fee3ae82000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fee3ac7e000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fee3aa4b000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fee3a847000)
/lib64/ld-linux-x86-64.so.2 (0x00007fee3c501000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fee3a637000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fee3a433000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fee3a219000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fee39ff2000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fee39d90000)
[root@cdn-test ~]#
[root@cdn-test ~]# ldd /usr/local/lib/libcurl.so.4 | grep ssl
libssl.so.10 => /lib64/libssl.so.10 (0x00007efd2c3a0000)
[root@cdn-test curl-7.80.0]# ./configure --prefix=/home/zhoulei/curl-7.80.0 --enable-tls-srp --with-openssl=/home/zhoulei/bin/ --with-nghttp2=/home/zhoulei/nghttp2-1.19.0
configure: Configured to build curl/libcurl:
Host setup: x86_64-pc-linux-gnu
Install prefix: /home/zhoulei/curl-7.80.0
Compiler: gcc -std=gnu11
CFLAGS: -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
CPPFLAGS: -isystem /home/zhoulei/bin/include -isystem /home/zhoulei/nghttp2-1.19.0/include
LDFLAGS: -L/home/zhoulei/bin/lib -L/home/zhoulei/nghttp2-1.19.0/lib
LIBS: -lnghttp2 -lssl -lcrypto -lssl -lcrypto -lz
curl version: 7.80.0
SSL: enabled (OpenSSL)
SSH: no (--with-{libssh,libssh2})
zlib: enabled
brotli: no (--with-brotli)
zstd: no (--with-zstd)
GSS-API: no (--with-gssapi)
GSASL: no (libgsasl not found)
TLS-SRP: enabled
resolver: POSIX threaded
IPv6: enabled
Unix sockets: enabled
IDN: no (--with-{libidn2,winidn})
Build libcurl: Shared=yes, Static=yes
Built-in manual: enabled
--libcurl option: enabled (--disable-libcurl-option)
Verbose errors: enabled (--disable-verbose)
Code coverage: disabled
SSPI: no (--enable-sspi)
ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt
ca cert path: no
ca fallback: no
LDAP: no (--enable-ldap / --with-ldap-lib / --with-lber-lib)
LDAPS: no (--enable-ldaps)
RTSP: enabled
RTMP: no (--with-librtmp)
PSL: no (libpsl not found)
Alt-svc: enabled (--disable-alt-svc)
HSTS: enabled (--disable-hsts)
HTTP1: enabled (internal)
HTTP2: enabled (nghttp2)
HTTP3: no (--with-ngtcp2, --with-quiche)
ECH: no (--enable-ech)
Protocols: DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP
Features: AsynchDNS HSTS HTTP2 HTTPS-proxy IPv6 Largefile NTLM NTLM_WB SSL TLS-SRP UnixSockets alt-svc libz
[root@cdn-test curl-7.80.0]#