blob: e3c05707db0400c99e8687c0c15864f9855b9838 [file] [log] [blame]
Nicolas Noble6ae8ef12015-01-16 15:03:42 -08001These instructions only cover building grpc C and C++ libraries under
2typical unix systems. If you need more information, please try grpc's
3wiki pages:
nnoble0005b772014-12-10 16:25:34 -08004
Nicolas Noble6ae8ef12015-01-16 15:03:42 -08005 https://github.com/google/grpc/wiki
nnoble0005b772014-12-10 16:25:34 -08006
Nicolas Noble6ae8ef12015-01-16 15:03:42 -08007
8*************************
9* If you are in a hurry *
10*************************
11
12A typical unix installation won't require any more steps than running:
13
14 $ make
15 # make install
16
Nicolas Noblec70752a2015-02-12 17:01:52 -080017You don't need anything else than GNU Make, gcc and autotools. Under a Debian
18or Ubuntu system, this should boil down to the following packages:
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080019
Nicolas Noblec70752a2015-02-12 17:01:52 -080020 # apt-get install build-essential autoconf libtool
21
22Building the python wrapper requires the following:
23
24 # apt-get install python-all-dev python-virtualenv
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080025
26
27*******************************
28* More detailled instructions *
29*******************************
30
31Setting up dependencies
32=======================
33
34Dependencies to compile the libraries
35-------------------------------------
36
37grpc libraries have few external dependencies. If you need to compile and
38install them, they are present in the third_party directory if you have
39cloned the github repository recursively. If you didn't clone recursively,
40you can still get them later by running the following command:
41
42 $ git submodule update --init
nnoble0005b772014-12-10 16:25:34 -080043
nnoble69ac39f2014-12-12 15:43:38 -080044Note that the Makefile makes it much easier for you to compile from sources
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080045if you were to clone recursively our git repository: it will automatically
46compile zlib and OpenSSL, which are core requirements for grpc. Note this
47creates grpc libraries that will have zlib and OpenSSL built-in inside of them,
48which significantly increases the libraries' size.
49
50In order to decrease that size, you can manually install zlib and OpenSSL on
51your system, so that the Makefile can use them instead.
52
53Under a Debian or Ubuntu system, one can acquire the development package
54for zlib this way:
55
56 # apt-get install zlib1g-dev
57
58To the best of our knowledge, no distribution has an OpenSSL package that
59supports ALPN yet, so you would still have to depend on installing from source
60for that particular dependency if you want to reduce the libraries' size.
61
62The recommended version of OpenSSL that provides ALPN support is available
63at this URL:
64
Nicolas "Pixel" Nobled5660212015-01-23 20:35:49 +010065 https://www.openssl.org/source/openssl-1.0.2.tar.gz
nnoble69ac39f2014-12-12 15:43:38 -080066
nnoble0005b772014-12-10 16:25:34 -080067
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080068Dependencies to compile and run the tests
69-----------------------------------------
nnoble0005b772014-12-10 16:25:34 -080070
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080071Compiling and running grpc plain-C tests dont't require any more dependency.
nnoble0005b772014-12-10 16:25:34 -080072
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080073
74Compiling and running grpc C++ tests depend on protobuf 3.0.0, gtest and
Nicolas Noblec70752a2015-02-12 17:01:52 -080075gflags. Although gflags is provided in third_party, you will need to manually
76install that dependency on your system to run these tests.
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080077
78Under a Debian or Ubuntu system, you can install the gtests and gflags packages
79using apt-get:
80
81 # apt-get install libgflags-dev libgtest-dev
82
Nicolas Noblec70752a2015-02-12 17:01:52 -080083However, protobuf 3.0.0 isn't in a debian package yet, but the Makefile will
84automatically try and compile the one present in third_party if you cloned the
85repository recursively, and that it detects your system is lacking it.
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080086
87Compiling and installing protobuf 3.0.0 requires a few more dependencies in
Nicolas Noblec70752a2015-02-12 17:01:52 -080088itself, notably the autoconf suite. If you have apt-get, you can install
89these dependencies this way:
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080090
Nicolas Noblec70752a2015-02-12 17:01:52 -080091 # apt-get install autoconf libtool
Nicolas Noble6ae8ef12015-01-16 15:03:42 -080092
93
94A word on OpenSSL
95-----------------
nnoble0005b772014-12-10 16:25:34 -080096
Abhishek Kumar3dd9df92015-02-10 10:16:41 -080097Secure HTTP2 requires the TLS extension ALPN (see rfc 7301 and
nnoble0005b772014-12-10 16:25:34 -080098http://http2.github.io/http2-spec/ section 3.3). Our HTTP2 implementation
Nicolas "Pixel" Nobled5660212015-01-23 20:35:49 +010099relies on OpenSSL's implementation. OpenSSL 1.0.2 is the first released version
nnoble0005b772014-12-10 16:25:34 -0800100of OpenSSL that has ALPN support, and this explains our dependency on it.
101
nnoble69ac39f2014-12-12 15:43:38 -0800102Note that the Makefile supports compiling only the unsecure elements of grpc,
103and if you do not have OpenSSL and do not want it, you can still proceed
Abhishek Kumar6749e732015-02-10 10:59:52 -0800104with installing only the elements you require. However, we strongly recommend
Abhishek Kumar3dd9df92015-02-10 10:16:41 -0800105the use of encryption for all network traffic, and discourage the use of grpc
106without TLS.
nnoble69ac39f2014-12-12 15:43:38 -0800107
nnoble0005b772014-12-10 16:25:34 -0800108
109Compiling
110=========
111
Nicolas Noble6ae8ef12015-01-16 15:03:42 -0800112If you have all the dependencies mentioned above, you should simply be able
113to go ahead and run "make" to compile grpc's C and C++ libraries:
nnoble0005b772014-12-10 16:25:34 -0800114
Nicolas Noble6ae8ef12015-01-16 15:03:42 -0800115 $ make
nnoble0005b772014-12-10 16:25:34 -0800116
117
118Testing
119=======
120
Nicolas Noble6ae8ef12015-01-16 15:03:42 -0800121To build and run the tests, you can run the command:
nnoble0005b772014-12-10 16:25:34 -0800122
Nicolas Noble6ae8ef12015-01-16 15:03:42 -0800123 $ make test
124
125If you want to be able to run them in parallel, and get better output, you can
126also use the python tool we have written:
127
128 $ ./tools/run_tests/run_tests.py
nnoble0005b772014-12-10 16:25:34 -0800129
130
131Installing
132==========
133
Nicolas Noble6ae8ef12015-01-16 15:03:42 -0800134Once everything is compiled, you should be able to install grpc C and C++
nnoble0005b772014-12-10 16:25:34 -0800135libraries and headers:
136
Nicolas Noble6ae8ef12015-01-16 15:03:42 -0800137 # make install