LoginSignup
10
9

More than 5 years have passed since last update.

nghttp2 を ubuntu でビルド

Posted at

HTTP2.0 draft-4 対応の nghttp を使うと、 spdylay の http2.0/draft-4 版が試せます。
(さすが tatsuhiro-t さん仕事が早い。。)

で、これを ubuntu でビルドする際のメモ。

基本の依存は公式に書いてある通り

dependencies
sudo apt-get install -y \
  autoconf              \
  automake              \
  autotools-dev         \
  libtool               \
  pkg-config            \
  zlib1g-dev            \
  libcunit1-dev         \
  libssl-dev            \
  libxml2-dev           \
  libevent-dev

で、これでビルドすると src/nghttp2.0 コマンドが出なかった。
-std=c++11 周りでエラー。

単純に gcc を 4.6 から 4.7 に上げてあげればよさそう。

その方法がこの辺にあった。

gcc4.7
sudo apt-get install -y python-software-properties
sudo apt-get update

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-4.7 g++-4.7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
sudo update-alternatives --list gcc
sudo update-alternatives --config gcc

それから、以下でビルドすると src 以下に nghttp, nghttpx, nghttpd ができる。

build
autoreconf -i
automake
autoconf
./configure
make

gcc-4.6 じゃないと不都合があるなら update-alternatives --config をもう一度やってもどせば良い。

10
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9