编译curl支持http3

Building curl with ngtcp2 involves 3 components:ngtcp2itself,nghttp3and a QUIC supporting TLS library. The supported TLS libraries are covered below.

  • ngtcp2: v1.2.0
  • nghttp3: v1.1.0

OpenSSL does not offer the required APIs for building a QUIC client. You need to use a TLS library that has such APIs and that works withngtcp2.

Build quictls:

% git clone --depth 1 -b openssl-3.1.4+quic https://github.com/quictls/openssl
% cd openssl
% ./config enable-tls1_3 --prefix=<somewhere1>
% make
% make install

Build nghttp3:

% cd ..
% git clone -b v1.1.0 https://github.com/ngtcp2/nghttp3
% cd nghttp3
% git submodule update --init
% autoreconf -fi
% ./configure --prefix=<somewhere2> --enable-lib-only
% make
% make install

Build ngtcp2:

% cd ..
% git clone -b v1.2.0 https://github.com/ngtcp2/ngtcp2
% cd ngtcp2
% autoreconf -fi
% ./configure PKG_CONFIG_PATH=<somewhere1>/lib/pkgconfig:<somewhere2>/lib/pkgconfig LDFLAGS="-Wl,-rpath,<somewhere1>/lib" --prefix=<somewhere3> --enable-lib-only
% make
% make install

Build curl:

% cd ..
% git clone https://github.com/curl/curl
% cd curl
% autoreconf -fi
% LDFLAGS="-Wl,-rpath,<somewhere1>/lib" ./configure --with-openssl=<somewhere1> --with-nghttp3=<somewhere2> --with-ngtcp2=<somewhere3>
% make
% make install

For OpenSSL 3.0.0 or later builds on Linux for x86_64 architecture, substitute all occurrences of “/lib” with “/lib64”

Categories: 系统运维