INSTALL 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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:
  4. https://github.com/google/grpc/wiki
  5. *************************
  6. * If you are in a hurry *
  7. *************************
  8. A typical unix installation won't require any more steps than running:
  9. $ make
  10. # make install
  11. You don't need anything else than GNU Make and gcc. Under a Debian or
  12. Ubuntu system, this should boil down to the following package:
  13. # apt-get install build-essential python-all-dev python-virtualenv
  14. *******************************
  15. * More detailled instructions *
  16. *******************************
  17. Setting up dependencies
  18. =======================
  19. Dependencies to compile the libraries
  20. -------------------------------------
  21. grpc libraries have few external dependencies. If you need to compile and
  22. install them, they are present in the third_party directory if you have
  23. cloned the github repository recursively. If you didn't clone recursively,
  24. you can still get them later by running the following command:
  25. $ git submodule update --init
  26. Note that the Makefile makes it much easier for you to compile from sources
  27. if you were to clone recursively our git repository: it will automatically
  28. compile zlib and OpenSSL, which are core requirements for grpc. Note this
  29. creates grpc libraries that will have zlib and OpenSSL built-in inside of them,
  30. which significantly increases the libraries' size.
  31. In order to decrease that size, you can manually install zlib and OpenSSL on
  32. your system, so that the Makefile can use them instead.
  33. Under a Debian or Ubuntu system, one can acquire the development package
  34. for zlib this way:
  35. # apt-get install zlib1g-dev
  36. To the best of our knowledge, no distribution has an OpenSSL package that
  37. supports ALPN yet, so you would still have to depend on installing from source
  38. for that particular dependency if you want to reduce the libraries' size.
  39. The recommended version of OpenSSL that provides ALPN support is available
  40. at this URL:
  41. https://www.openssl.org/source/openssl-1.0.2.tar.gz
  42. Dependencies to compile and run the tests
  43. -----------------------------------------
  44. Compiling and running grpc plain-C tests dont't require any more dependency.
  45. Compiling and running grpc C++ tests depend on protobuf 3.0.0, gtest and
  46. gflags. Although gflags and protobuf are provided in third_party, you will
  47. need to manually install these dependencies on your system to run these tests.
  48. Under a Debian or Ubuntu system, you can install the gtests and gflags packages
  49. using apt-get:
  50. # apt-get install libgflags-dev libgtest-dev
  51. However, protobuf 3.0.0 isn't in a debian package yet: you'll need to compile
  52. and install it from the sources in the third_party. Note that if you already
  53. have the protobuf and protoc packages installed on your system, they will most
  54. likely interfere, and you'll need to uninstall them first.
  55. Compiling and installing protobuf 3.0.0 requires a few more dependencies in
  56. itself, notably the autoconf suite, curl, and unzip. If you have apt-get, you
  57. can install these dependencies this way:
  58. # apt-get install unzip curl autoconf libtool
  59. Then, you can build and install protobuf 3.0.0:
  60. $ cd third_party/protobuf
  61. $ ./autogen.sh
  62. $ ./configure
  63. $ make
  64. # make install
  65. # ldconfig
  66. A word on OpenSSL
  67. -----------------
  68. Secure HTTP2 requires to have the TLS extension ALPN (see rfc 7301 and
  69. http://http2.github.io/http2-spec/ section 3.3). Our HTTP2 implementation
  70. relies on OpenSSL's implementation. OpenSSL 1.0.2 is the first released version
  71. of OpenSSL that has ALPN support, and this explains our dependency on it.
  72. Note that the Makefile supports compiling only the unsecure elements of grpc,
  73. and if you do not have OpenSSL and do not want it, you can still proceed
  74. with installing only the elements you require. However, it is recommended
  75. to encrypt your network traffic, therefore we urge you to not use the unsecure
  76. version of grpc if possible.
  77. Compiling
  78. =========
  79. If you have all the dependencies mentioned above, you should simply be able
  80. to go ahead and run "make" to compile grpc's C and C++ libraries:
  81. $ make
  82. Testing
  83. =======
  84. To build and run the tests, you can run the command:
  85. $ make test
  86. If you want to be able to run them in parallel, and get better output, you can
  87. also use the python tool we have written:
  88. $ ./tools/run_tests/run_tests.py
  89. Installing
  90. ==========
  91. Once everything is compiled, you should be able to install grpc C and C++
  92. libraries and headers:
  93. # make install