在Centos7下安装nghttp2

编译nghttp2

首先是各种依赖

yum install libev-devel libevent-devel c-ares-devel jemalloc-devel jansson-devel python-devel zlib-devel

然后

./configure
make
make install

如果在make的过程中遇到这样的错误

error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

说明系统的编译器版本过旧, 需要安装Red Hat Developer Toolset https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/

sudo yum install centos-release-scl
# 这行不运行貌似也可以
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
# 安装
sudo yum install devtoolset-7
# 检查已安装的列表
sudo yum list devtoolset-7\*
# 这一步才会启用新安装的编译器, 之后运行./configure能看到 C++ compilern 增加了-std=c++14参数
scl enable devtoolset-7 bash

.然后再./configure 和 make 就可以通过了

最后记得运行ldconfig更新动态链接库

sudo ldconfig

.

猜你喜欢

转载自www.cnblogs.com/milton/p/10369293.html
今日推荐