Skip to content

Building curl with crustls and Hyper

Jacob Hoffman-Andrews edited this page Feb 12, 2021 · 3 revisions

How to build curl with both Hyper and rustls (in debug mode):

Install the Rust toolchain: https://rustup.rs/

Clone, build, and install crustls:

git clone https://github.com/abetterinternet/crustls $HOME/rust/crustls
cd $HOME/rust/crustls
make
sudo make install

Clone, build and install hyper:

git clone https://github.com/hyperium/hyper $HOME/rust/hyper
cd $HOME/rust/hyper
RUSTFLAGS="--cfg hyper_unstable_ffi" cargo build --features client,http1,http2,ffi
sudo install target/debug/libhyper.a /usr/local/lib/
sudo install target/debug/libhyper.so /usr/local/lib/
sudo install capi/include/hyper.h /usr/local/include/

Install autotools and libtool (distro-dependent; apt install autoconf libtool on debalikes).

Clone, configure and build curl:

git clone https://github.com/curl/curl/ $HOME/c/curl
cd $HOME/c/curl
autoreconf -fi
./configure --with-hyper --with-rustls --without-ssl --enable-debug

Verify configure output contains:

  • SSL: enabled (rustls)
  • WARNING: Hyper enabled but marked EXPERIMENTAL. Use with caution!
make -j12
export LD_LIBRARY_PATH=/usr/local/lib
./src/curl --version # verify the first line contains "rustls" and "Hyper"
./src/curl https://httpbin.org/headers -i
Clone this wiki locally