curl support of HTTP2

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.)
Author Message
imdy
DD-WRT Novice


Joined: 12 Jun 2019
Posts: 4

PostPosted: Wed Jun 12, 2019 22:10    Post subject: curl support of HTTP2 Reply with quote
Hi,
I'm trying to use curl with HTTP2 with no success. It works fine with HTTP1.1 though.
I'm using the latest curl version (installed using opkg).

My router: Linksys WRT1200ACv2.
Firmware: DD-WRT v3.0-r39944 std (06/04/19).

When checking the features of curl, indeed HTTP2 is not listed:
Code:

root@MYROUTER:~# /opt/bin/curl --version
curl 7.64.1 (arm-openwrt-linux-gnu) libcurl/7.64.1 OpenSSL/1.1.1b zlib/1.2.11
Release-Date: 2019-03-27
Protocols: file ftp ftps http https imap imaps pop3 pop3s rtsp smtp smtps tftp
Features: HTTPS-proxy IPv6 Largefile libz SSL
root@MYROUTER:~#


Just as reference, when checking the same on my Mac, HTTP2 is listed (and is also working):
Code:

dms-Mac:~ dm$ curl --version
curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy
dms-Mac:~ dm$


Can anyone help me to get it working?

Thanks!
Sponsor
imdy
DD-WRT Novice


Joined: 12 Jun 2019
Posts: 4

PostPosted: Sun Jun 16, 2019 8:27    Post subject: Building curl for dd-wrt Reply with quote
I've realized that in order to enable HTTP2 in curl, I need to build it with --with-nghttp2.

I've downloaded the curl sources and the dd-wrt toolchain to my ubuntu 16.04 machine and tried to build curl.

However, the build fails and I suspect I'm doing something wrong in the setup of the toolchain (the build works fine for the ubuntu target).

The error I'm getting is:
Quote:

ld: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.27' not found


Can anyone help with how to use the toolchain for building curl?
imdy
DD-WRT Novice


Joined: 12 Jun 2019
Posts: 4

PostPosted: Fri Jun 21, 2019 10:26    Post subject: Building curl with HTTP2 for dd-wrt Reply with quote
Finally, I got it working after a lot of trial and error.
I'm posting what I've done in case anyone else find it useful.

The error I've faced of "version `GLIBC_2.27' not found" was due to old version of Ubuntu (16.04). Once I upgraded to Ubuntu 18.04 this error was solved.
All the steps below are done on my Ubuntu 18.04 using the dd-wrt toolchains.

In a nutshell, the steps are:

    1. I've created a new directory that will serve as root folder for all files in this process. In my case, I created the folder: "/media/mydoc/dm_build_curl/"
    2. Build OpenSSL.
    3. Build nghttp2.
    4. Build curl (statically) using the artifacts of the OpenSSL & nghttp2 artifacts.
    5. Copy the newly built curl to my dd-wrt WRT1200ACv2 router.


Prerequisites:
Quote:

mkdir /media/mydoc/dm_build_curl/
install toolchain in "/media/mydoc/dm_build_curl/toolchains/toolchain-arm_cortex-a9+vfpv3_gcc-8.2.0_musl_eabi/"
Add to ~/.profile: "PATH="/media/mydoc/dm_build_curl/toolchains/toolchain-arm_cortex-a9+vfpv3_gcc-8.2.0_musl_eabi/bin:$PATH""
sudo apt-get -y install build-essential pkg-config
reboot Ubuntu


Building OpenSSL
Quote:

cd /media/mydoc/dm_build_curl
mkdir usr_local_ssl
wget https://www.openssl.org/source/openssl-1.1.1b.tar.gz
tar xvf openssl-1.1.1b.tar.gz
cd /media/mydoc/dm_build_curl/openssl-1.1.1b
export CROSS_COMPILE=arm-openwrt-linux-muslgnueabi-
./Configure linux-generic32 -DL_ENDIAN no-shared no-ssl2 --prefix=/media/mydoc/dm_build_curl/usr_local_ssl --openssldir=/media/mydoc/dm_build_curl/usr_local_ssl
make install


Building nghttp2
Quote:

cd /media/mydoc/dm_build_curl
mkdir usr_local_nghttp2
wget https://github.com/nghttp2/nghttp2/releases/download/v1.38.0/nghttp2-1.38.0.tar.xz
tar xvf nghttp2-1.38.0.tar.xz
cd /media/mydoc/dm_build_curl/nghttp2-1.38.0
./configure --host=arm-openwrt-linux-muslgnueabi --prefix=/media/mydoc/dm_build_curl/usr_local_nghttp2 --enable-lib-only
make
make install


Building curl
Quote:

cd /media/mydoc/dm_build_curl
mkdir dm_final
wget https://curl.haxx.se/download/curl-7.64.1.tar.gz
tar xvf curl-7.64.1.tar.gz
cd /media/mydoc/dm_build_curl/curl-7.64.1
./configure --host=arm-openwrt-linux-muslgnueabi --prefix=/media/mydoc/dm_build_curl/dm_final --with-ssl=/media/mydoc/dm_build_curl/usr_local_ssl --disable-shared --with-nghttp2=/media/mydoc/dm_build_curl/usr_local_nghttp2
make
make install


After copying curl to my router, I was able to use http2.
imdy
DD-WRT Novice


Joined: 12 Jun 2019
Posts: 4

PostPosted: Sun Jun 23, 2019 3:56    Post subject: Reply with quote
Small correction to the nghttp2 build in order to make curl fully static linked (adding --enable-shared=no):

Code:

cd /media/mydoc/dm_build_curl
mkdir usr_local_nghttp2
wget https://github.com/nghttp2/nghttp2/releases/download/v1.38.0/nghttp2-1.38.0.tar.xz
tar xvf nghttp2-1.38.0.tar.xz
cd /media/mydoc/dm_build_curl/nghttp2-1.38.0
./configure --host=arm-openwrt-linux-muslgnueabi --prefix=/media/mydoc/dm_build_curl/usr_local_nghttp2 --enable-lib-only --enable-shared=no
make
make install
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.) All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum