371 lines
18 KiB
HTML
371 lines
18 KiB
HTML
|
|
||
|
|
||
|
<!DOCTYPE html>
|
||
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
||
|
<title>Building Android binary — nghttp2 0.6.0-DEV documentation</title>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="top" title="nghttp2 0.6.0-DEV documentation" href="index.html"/>
|
||
|
<link rel="next" title="Tutorial: HTTP/2 client" href="tutorial-client.html"/>
|
||
|
<link rel="prev" title="nghttp2 - HTTP/2 C Library" href="package_README.html"/>
|
||
|
|
||
|
|
||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body class="wy-body-for-nav" role="document">
|
||
|
|
||
|
<div class="wy-grid-for-nav">
|
||
|
|
||
|
|
||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||
|
<div class="wy-side-nav-search">
|
||
|
<a href="index.html" class="fa fa-home"> nghttp2</a>
|
||
|
<div role="search">
|
||
|
<form id ="rtd-search-form" class="wy-form" action="search.html" method="get">
|
||
|
<input type="text" name="q" placeholder="Search docs" />
|
||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||
|
<input type="hidden" name="area" value="default" />
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||
|
|
||
|
|
||
|
<ul class="current">
|
||
|
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#public-test-server">Public Test Server</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#python-bindings">Python bindings</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1 current"><a class="current reference internal" href="">Building Android binary</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="tutorial-server.html">Tutorial: HTTP/2 server</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="tutorial-server.html#libevent-server-c">libevent-server.c</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="tutorial-hpack.html">Tutorial: HPACK API</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#deflating-encoding-headers">Deflating (encoding) headers</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#inflating-decoding-headers">Inflating (decoding) headers</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#deflate-c">deflate.c</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="nghttpx-howto.html">nghttpx - HTTP/2 proxy - HOW-TO</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#default-mode">Default mode</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#http-2-proxy-mode">HTTP/2 proxy mode</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#client-mode">Client mode</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#client-proxy-mode">Client proxy mode</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#http-2-bridge-mode">HTTP/2 bridge mode</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#disable-ssl-tls">Disable SSL/TLS</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#basic-usage">Basic Usage</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#flow-control">Flow Control</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#multi-threading">Multi-Threading</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#selecting-protocol-for-clear-text">Selecting protocol for clear text</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#multiple-uris">Multiple URIs</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="apiref.html">API Reference</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="apiref.html#includes">Includes</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="apiref.html#remarks">Remarks</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="apiref.html#macros">Macros</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="apiref.html#enums">Enums</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="apiref.html#types-structs-unions-and-typedefs">Types (structs, unions and typedefs)</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="apiref.html#functions">Functions</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="python-apiref.html">Python API Reference</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="python-apiref.html#hpack-api">HPACK API</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="python-apiref.html#http-2-servers">HTTP/2 servers</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="nghttp2.h.html">nghttp2.h</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="nghttp2ver.h.html">nghttp2ver.h</a></li>
|
||
|
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
|
||
|
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</nav>
|
||
|
|
||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||
|
|
||
|
|
||
|
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||
|
<a href="index.html">nghttp2</a>
|
||
|
</nav>
|
||
|
|
||
|
|
||
|
|
||
|
<div class="wy-nav-content">
|
||
|
<div class="rst-content">
|
||
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
||
|
<ul class="wy-breadcrumbs">
|
||
|
<li><a href="index.html">Docs</a> »</li>
|
||
|
|
||
|
<li>Building Android binary</li>
|
||
|
<li class="wy-breadcrumbs-aside">
|
||
|
|
||
|
</li>
|
||
|
</ul>
|
||
|
<hr/>
|
||
|
</div>
|
||
|
<div role="main">
|
||
|
|
||
|
<div class="section" id="building-android-binary">
|
||
|
<h1>Building Android binary<a class="headerlink" href="#building-android-binary" title="Permalink to this headline">¶</a></h1>
|
||
|
<p>In this article, we briefly describe how to build Android binary using
|
||
|
<a class="reference external" href="http://developer.android.com/tools/sdk/ndk/index.html">Android NDK</a>
|
||
|
cross-compiler on Debian Linux.</p>
|
||
|
<p>We offer <tt class="docutils literal"><span class="pre">android-config</span></tt> and <tt class="docutils literal"><span class="pre">android-make</span></tt> scripts to make the
|
||
|
build easier. To make these script work, NDK toolchain must be
|
||
|
installed in the following way. First, let us introduce
|
||
|
<tt class="docutils literal"><span class="pre">ANDROID_HOME</span></tt> environment variable. We need to install toolchain
|
||
|
under <tt class="docutils literal"><span class="pre">$ANDROID_HOME/toolchain</span></tt>. An user can freely choose the path
|
||
|
for <tt class="docutils literal"><span class="pre">ANDROID_HOME</span></tt>. For example, to install toolchain under
|
||
|
<tt class="docutils literal"><span class="pre">$ANDROID_HOME/toolchain</span></tt>, do this in the the directory where NDK is
|
||
|
unpacked:</p>
|
||
|
<div class="highlight-c"><div class="highlight"><pre>$ build/tools/make-standalone-toolchain.sh \
|
||
|
--install-dir=$ANDROID_HOME/toolchain \
|
||
|
--toolchain=arm-linux-androideabi-4.8 \
|
||
|
--llvm-version=3.4
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<p>The additional flag <tt class="docutils literal"><span class="pre">--system=linux-x86_64</span></tt> may be required if you
|
||
|
are using x86_64 system.</p>
|
||
|
<p>The platform level is not important here because we don’t use Android
|
||
|
specific C/C++ API.</p>
|
||
|
<p>The dependent libraries, such as OpenSSL and libevent should be built
|
||
|
with the toolchain and installed under <tt class="docutils literal"><span class="pre">$ANDROID_HOME/usr/local</span></tt>.
|
||
|
We recommend to build these libraries as static library to make the
|
||
|
deployment easier. libxml2 support is currently disabled.</p>
|
||
|
<p>We use zlib which comes with Android NDK, so we don’t have to build it
|
||
|
by ourselves.</p>
|
||
|
<p>If SPDY support is required for nghttpx and h2load, build and install
|
||
|
spdylay as well.</p>
|
||
|
<p>Before running <tt class="docutils literal"><span class="pre">android-config</span></tt> and <tt class="docutils literal"><span class="pre">android-make</span></tt>,
|
||
|
<tt class="docutils literal"><span class="pre">ANDROID_HOME</span></tt> environment variable must be set to point to the
|
||
|
correct path. Also add <tt class="docutils literal"><span class="pre">$ANDROID_HOME/toolchain/bin</span></tt> to <tt class="docutils literal"><span class="pre">PATH</span></tt>:</p>
|
||
|
<div class="highlight-c"><div class="highlight"><pre>$ export PATH=$PATH:$ANDROID_HOME/toolchain/bin
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<p>To configure OpenSSL, use the following script:</p>
|
||
|
<div class="highlight-c"><div class="highlight"><pre>#!/bin/sh
|
||
|
|
||
|
if [ -z "$ANDROID_HOME" ]; then
|
||
|
echo 'No $ANDROID_HOME specified.'
|
||
|
exit 1
|
||
|
fi
|
||
|
PREFIX=$ANDROID_HOME/usr/local
|
||
|
TOOLCHAIN=$ANDROID_HOME/toolchain
|
||
|
PATH=$TOOLCHAIN/bin:$PATH
|
||
|
|
||
|
export CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi-
|
||
|
./Configure --prefix=$PREFIX android
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<p>And run <tt class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></tt> to build and install.</p>
|
||
|
<p>To configure libevent, use the following script:</p>
|
||
|
<div class="highlight-c"><div class="highlight"><pre>#!/bin/sh
|
||
|
|
||
|
if [ -z "$ANDROID_HOME" ]; then
|
||
|
echo 'No $ANDROID_HOME specified.'
|
||
|
exit 1
|
||
|
fi
|
||
|
PREFIX=$ANDROID_HOME/usr/local
|
||
|
TOOLCHAIN=$ANDROID_HOME/toolchain
|
||
|
PATH=$TOOLCHAIN/bin:$PATH
|
||
|
|
||
|
./configure \
|
||
|
--host=arm-linux-androideabi \
|
||
|
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
|
||
|
--prefix=$PREFIX \
|
||
|
--disable-shared \
|
||
|
--enable-static \
|
||
|
CPPFLAGS=-I$PREFIX/include \
|
||
|
LDFLAGS=-L$PREFIX/lib
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<p>And run <tt class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></tt> to build and install.</p>
|
||
|
<p>To configure spdylay, use the following script:</p>
|
||
|
<div class="highlight-c"><div class="highlight"><pre>if [ -z "$ANDROID_HOME" ]; then
|
||
|
echo 'No $ANDROID_HOME specified.'
|
||
|
exit 1
|
||
|
fi
|
||
|
PREFIX=$ANDROID_HOME/usr/local
|
||
|
TOOLCHAIN=$ANDROID_HOME/toolchain
|
||
|
PATH=$TOOLCHAIN/bin:$PATH
|
||
|
|
||
|
./configure \
|
||
|
--disable-shared \
|
||
|
--host=arm-linux-androideabi \
|
||
|
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
|
||
|
--prefix=$PREFIX \
|
||
|
--without-libxml2 \
|
||
|
--disable-src \
|
||
|
--disable-examples \
|
||
|
CPPFLAGS="-I$PREFIX/include" \
|
||
|
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \
|
||
|
LDFLAGS="-L$PREFIX/lib"
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<p>And run <tt class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></tt> to build and install. After spdylay
|
||
|
installation, edit $ANDROID_HOME/usr/local/lib/pkgconfig/libspdylay.pc
|
||
|
and remove the following line:</p>
|
||
|
<div class="highlight-c"><div class="highlight"><pre><span class="n">Requires</span><span class="p">.</span><span class="n">private</span><span class="o">:</span> <span class="n">zlib</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<p>After prerequisite libraries are prepared, run <tt class="docutils literal"><span class="pre">android-config</span></tt> and
|
||
|
then <tt class="docutils literal"><span class="pre">android-make</span></tt> to compile nghttp2 source files.</p>
|
||
|
<p>If all went well, application binaries, such as nghttpx, are created
|
||
|
under src directory. Strip debugging information from the binary
|
||
|
using the following command:</p>
|
||
|
<div class="highlight-c"><div class="highlight"><pre>$ arm-linux-androideabi-strip src/nghttpx
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
<footer>
|
||
|
|
||
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||
|
|
||
|
<a href="tutorial-client.html" class="btn btn-neutral float-right" title="Tutorial: HTTP/2 client">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||
|
|
||
|
|
||
|
<a href="package_README.html" class="btn btn-neutral" title="nghttp2 - HTTP/2 C Library"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<hr/>
|
||
|
|
||
|
<div role="contentinfo">
|
||
|
<p>
|
||
|
© Copyright 2012, 2014, Tatsuhiro Tsujikawa.
|
||
|
</p>
|
||
|
</div>
|
||
|
|
||
|
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
|
||
|
</footer>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</section>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
var DOCUMENTATION_OPTIONS = {
|
||
|
URL_ROOT:'./',
|
||
|
VERSION:'0.6.0-DEV',
|
||
|
COLLAPSE_INDEX:false,
|
||
|
FILE_SUFFIX:'.html',
|
||
|
HAS_SOURCE: false
|
||
|
};
|
||
|
</script>
|
||
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
||
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
||
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<script type="text/javascript" src="_static/js/theme.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
jQuery(function () {
|
||
|
SphinxRtdTheme.StickyNav.enable();
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|