iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
✨

Building cURL with OpenSSL 3.2 and HTTP/3 Support

に公開
2024/04/30

I built cURL with OpenSSL 3.2 and HTTP/3 support for experimental purposes. OpenSSL 3.2, released in December 2023, started supporting the QUIC client API.

Since I needed to build cURL for various TLS libraries, I used the $HOME/http3 directory as a base. The OS is Debian 12 Bookworm under the Linux environment of a Chromebook. Regarding build tools, I installed the following packages for building nghttp2, which is described later.

sudo apt-get install g++ clang make binutils autoconf automake \
  autotools-dev libtool pkg-config

First, I built it with OpenSSL v3.2 as the backend. I also tried OpenSSL v3.3, but it did not work out.

I will set the home directory to $HOME/http3/openssl3.2. First, build OpenSSL 3.2.

git clone --depth 1 -b openssl-3.2.0 https://github.com/openssl/openssl
cd openssl
./config --prefix=$PWD/.. --libdir=$PWD/../lib
make
make install
cd ../

You can also specify build options such as ./config enable-tls1_3, but it is unnecessary with the latest OpenSSL.

Confirm that the include and lib directories are generated under $HOME/http3/openssl3.2.

ls

Additionally, verify that the *.pc files for pkg-config are generated in lib/pkgconfig. You can specify this path as a search target for pkg-config by setting the PKG_CONFIG_PATH variable.

ls lib/pkgconfig

Next, build nghttp3 v1.1.0.

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

Finally, build cURL.

git clone https://github.com/curl/curl
cd curl
autoreconf -fi
PKG_CONFIG_PATH=$PWD/../lib/pkgconfig \
./configure \
--prefix=$PWD/.. \
--with-openssl \
--with-openssl-quic \
--with-nghttp3

Visually confirm that HTTP/3 is enabled.

Build and install it.

make
make install
cd ../

Let's check the version of cURL.

bin/curl --version

If you also want to support HTTP/2, build nghttp2.

git clone -b v1.61.0 https://github.com/nghttp2/nghttp2
cd nghttp2
autoreconf -fi
PKG_CONFIG_PATH=$PWD/../lib/pkgconfig \
  ./configure --prefix=$PWD/..
make
make install
cd ../

Rebuild cURL.

cd curl
PKG_CONFIG_PATH=$PWD/../lib/pkgconfig \
./configure \
--prefix=$PWD/.. \
--with-openssl \
--with-openssl-quic \
--with-nghttp3
make
make install
cd ../

Discussion