当前位置: 首页 > 工具软件 > Nghttp2 > 使用案例 >

HTTP2编译可执行程序,nghttp,nghttpd,nghttpv等程序

郎德馨
2023-12-01

1.以下软件包是构建libnghttp2库所必需的:
pkg-config> = 0.20
版本核对: pkg-config --version

2.要构建和运行单元测试程序,需要以下软件包:
cunit >= 2.1
版本核对:
安装:编译依次执行aclocal,autoheader,autoconf,automake

如果遇到下面问题:
sed: can’t read ./ltmain.sh: No such file or directory
sed: can’t read libtoolT: No such file or directory
解决:libtoolize --automake --copy --debug --force

3.如果仅需要libnghttp2(C库),则只需要上述软件包。
使用–enable-lib-only,以确保只有libnghttp2建成。这避免了与构建捆绑的应用程序有关的潜在构建错误。

4.要构建并运行应用程序(nghttp,nghttpd, nghttpx和h2load)在src目录,需要以下包:
OpenSSL> = 1.0.1 (版本核对: openssl version)
libev> = 4.11 (版本核对: /usr/local/lib下)
zlib> = 1.2.3 (版本核对: /usr/local/lib下)
libc-ares> = 1.7.5

5.上面4的依赖的安装
注:
5.1 libev安装
wget http://dist.schmorp.de/libev/libev-4.22.tar.gz
或者wget https://github.com/daidaotian/libev/archive/master.zip
export LIBDIR=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib
export LD_RUN_PATH=/usr/local/lib

5.2 zlib的安装
wget http://www.zlib.net/zlib-1.2.11.tar.gz

5.3 libcares的安装
wget https://c-ares.haxx.se/download/c-ares-1.14.0.tar.gz

aclocal和automake的版本一样,只需要安装automake即可。
下载地址:https://ftp.gnu.org/gnu/automake/

安装都是基本步骤:执行configure;make -j 8;make install

6.编译步骤:
./configure PKG_CONFIG_PATH=/usr/lib/pkgconfig --enable-app --prefix=$INSTALL_PATH
make -j 8
make install

 类似资料: