aboutsummaryrefslogtreecommitdiffhomepage
path: root/INSTALL.md
blob: 7bdb9b273fdcc0f4054d693db08fe67615285ad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#If you are in a hurry

For language-specific installation instructions for gRPC runtime, please
refer to these documents

 * [C++](examples/cpp): Currently to install gRPC for C++, you need to build from source as described below.
 * [C#](src/csharp): NuGet package `Grpc`
 * [Go](https://github.com/grpc/grpc-go): `go get google.golang.org/grpc`
 * [Java](https://github.com/grpc/grpc-java)
 * [Node](src/node): `npm install grpc`
 * [Objective-C](src/objective-c)
 * [PHP](src/php): `pecl install grpc-beta`
 * [Python](src/python/grpcio): `pip install grpcio`
 * [Ruby](src/ruby): `gem install grpc`


#Pre-requisites

##Linux

```sh
 $ [sudo] apt-get install build-essential autoconf libtool
```

##Mac OSX

For a Mac system, git is not available by default. You will first need to
install Xcode from the Mac AppStore and then run the following command from a
terminal:

```sh
 $ [sudo] xcode-select --install
```

##Protoc

By default gRPC uses [protocol buffers](https://github.com/google/protobuf),
you will need the `protoc` compiler to generate stub server and client code.

If you compile gRPC from source, as described below, the Makefile will
automatically try and compile the `protoc` in third_party if you cloned the
repository recursively and it detects that you don't already have it
installed.


#Build from Source

For developers who are interested to contribute, here is how to compile the
gRPC C Core library.

```sh
 $ git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
 $ cd grpc
 $ git submodule update --init
 $ make
 $ [sudo] make install
```

##Windows

There are several ways to build under Windows, of varying complexity depending
on experience with the tools involved.

<!--
###Visual Studio

Versions 2013 and 2015 are both supported. You can use [their respective
community
editions](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx).

Building the C Core:
- Open [grpc.sln](https://github.com/grpc/grpc/blob/master/vsprojects/grpc.sln).
- Select your build target.
- Build the `grpc` project.

Building the C++ runtime:
- You need [CMake](https://cmake.org/) on your path to build protobuf (see below
  for building using solely CMake).
- Run `vsprojects/build_protos.bat` (needs `cmake.exe` in your path).
- Open [buildtests_cxx.sln]()
- Select your build target.
- build the `grpc++` project.
-->

###msys2

This approach requires having [msys2](https://msys2.github.io/) installed.

- The Makefile (and source code) should support msys2's mingw32 and mingw64
  compilers. Building with msys2's native compiler is also possible, but
  difficult.
- The Makefile is expecting the Windows versions of OpenSSL (see
  https://slproweb.com/products/Win32OpenSSL.html). It's also possible to build
  the Windows version of OpenSSL from scratch. The output should be `libeay32`
  and `ssleay32`.
- If you are not installing the above files under msys2's path, you may specify
  it, for instance, in the following way:
  ```CPPFLAGS=”-I/c/OpenSSL-Win32/include” LDFLAGS=”-L/c/OpenSSL-Win32/lib” make static_c```
- [protobuf3](https://github.com/google/protobuf/blob/master/src/README.md#c-installation---windows)
  must be installed on the msys2 path.

###Cmake (experimental)

- Install [CMake](https://cmake.org/download/).
- Run it over [grpc's
  CMakeLists.txt](https://github.com/grpc/grpc/blob/master/CMakeLists.txt) to
  generate "projects" for your compiler.
- Build with your compiler of choice. The generated build files should have the
  protobuf3 dependency baked in.