Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 1 | These instructions only cover building grpc C and C++ libraries under |
| 2 | typical unix systems. If you need more information, please try grpc's |
| 3 | wiki pages: |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 4 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 5 | https://github.com/google/grpc/wiki |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 6 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 7 | |
| 8 | ************************* |
| 9 | * If you are in a hurry * |
| 10 | ************************* |
| 11 | |
| 12 | A typical unix installation won't require any more steps than running: |
| 13 | |
| 14 | $ make |
| 15 | # make install |
| 16 | |
| 17 | You don't need anything else than GNU Make and gcc. Under a Debian or |
| 18 | Ubuntu system, this should boil down to the following package: |
| 19 | |
Nathaniel Manista | 840615e | 2015-01-22 20:31:47 +0000 | [diff] [blame^] | 20 | # apt-get install build-essential python-all-dev python-virtualenv |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 21 | |
| 22 | |
| 23 | ******************************* |
| 24 | * More detailled instructions * |
| 25 | ******************************* |
| 26 | |
| 27 | Setting up dependencies |
| 28 | ======================= |
| 29 | |
| 30 | Dependencies to compile the libraries |
| 31 | ------------------------------------- |
| 32 | |
| 33 | grpc libraries have few external dependencies. If you need to compile and |
| 34 | install them, they are present in the third_party directory if you have |
| 35 | cloned the github repository recursively. If you didn't clone recursively, |
| 36 | you can still get them later by running the following command: |
| 37 | |
| 38 | $ git submodule update --init |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 39 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 40 | Note that the Makefile makes it much easier for you to compile from sources |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 41 | if you were to clone recursively our git repository: it will automatically |
| 42 | compile zlib and OpenSSL, which are core requirements for grpc. Note this |
| 43 | creates grpc libraries that will have zlib and OpenSSL built-in inside of them, |
| 44 | which significantly increases the libraries' size. |
| 45 | |
| 46 | In order to decrease that size, you can manually install zlib and OpenSSL on |
| 47 | your system, so that the Makefile can use them instead. |
| 48 | |
| 49 | Under a Debian or Ubuntu system, one can acquire the development package |
| 50 | for zlib this way: |
| 51 | |
| 52 | # apt-get install zlib1g-dev |
| 53 | |
| 54 | To the best of our knowledge, no distribution has an OpenSSL package that |
| 55 | supports ALPN yet, so you would still have to depend on installing from source |
| 56 | for that particular dependency if you want to reduce the libraries' size. |
| 57 | |
| 58 | The recommended version of OpenSSL that provides ALPN support is available |
| 59 | at this URL: |
| 60 | |
| 61 | https://www.openssl.org/source/openssl-1.0.2-beta3.tar.gz |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 62 | |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 63 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 64 | Dependencies to compile and run the tests |
| 65 | ----------------------------------------- |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 66 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 67 | Compiling and running grpc plain-C tests dont't require any more dependency. |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 68 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 69 | |
| 70 | Compiling and running grpc C++ tests depend on protobuf 3.0.0, gtest and |
| 71 | gflags. Although gflags and protobuf are provided in third_party, you will |
| 72 | need to manually install these dependencies on your system to run these tests. |
| 73 | |
| 74 | Under a Debian or Ubuntu system, you can install the gtests and gflags packages |
| 75 | using apt-get: |
| 76 | |
| 77 | # apt-get install libgflags-dev libgtest-dev |
| 78 | |
| 79 | However, protobuf 3.0.0 isn't in a debian package yet: you'll need to compile |
| 80 | and install it from the sources in the third_party. Note that if you already |
| 81 | have the protobuf and protoc packages installed on your system, they will most |
| 82 | likely interfere, and you'll need to uninstall them first. |
| 83 | |
| 84 | Compiling and installing protobuf 3.0.0 requires a few more dependencies in |
| 85 | itself, notably the autoconf suite, curl, and unzip. If you have apt-get, you |
| 86 | can install these dependencies this way: |
| 87 | |
| 88 | # apt-get install unzip curl autotools-dev |
| 89 | |
| 90 | Then, you can build and install protobuf 3.0.0: |
| 91 | |
| 92 | $ cd third_party/protobuf |
| 93 | $ ./configure |
| 94 | $ make |
| 95 | # make install |
| 96 | # ldconfig |
| 97 | |
| 98 | |
| 99 | A word on OpenSSL |
| 100 | ----------------- |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 101 | |
| 102 | Secure HTTP2 requires to have the TLS extension ALPN (see rfc 7301 and |
| 103 | http://http2.github.io/http2-spec/ section 3.3). Our HTTP2 implementation |
| 104 | relies on OpenSSL's implementation. OpenSSL 1.0.2beta3 is the first version |
| 105 | of OpenSSL that has ALPN support, and this explains our dependency on it. |
| 106 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 107 | Note that the Makefile supports compiling only the unsecure elements of grpc, |
| 108 | and if you do not have OpenSSL and do not want it, you can still proceed |
| 109 | with installing only the elements you require. However, it is recommended |
| 110 | to encrypt your network traffic, therefore we urge you to not use the unsecure |
| 111 | version of grpc if possible. |
| 112 | |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 113 | |
| 114 | Compiling |
| 115 | ========= |
| 116 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 117 | If you have all the dependencies mentioned above, you should simply be able |
| 118 | to go ahead and run "make" to compile grpc's C and C++ libraries: |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 119 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 120 | $ make |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 121 | |
| 122 | |
| 123 | Testing |
| 124 | ======= |
| 125 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 126 | To build and run the tests, you can run the command: |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 127 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 128 | $ make test |
| 129 | |
| 130 | If you want to be able to run them in parallel, and get better output, you can |
| 131 | also use the python tool we have written: |
| 132 | |
| 133 | $ ./tools/run_tests/run_tests.py |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 134 | |
| 135 | |
| 136 | Installing |
| 137 | ========== |
| 138 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 139 | Once everything is compiled, you should be able to install grpc C and C++ |
nnoble | 0005b77 | 2014-12-10 16:25:34 -0800 | [diff] [blame] | 140 | libraries and headers: |
| 141 | |
Nicolas Noble | 6ae8ef1 | 2015-01-16 15:03:42 -0800 | [diff] [blame] | 142 | # make install |