comparison src/capnproto-0.6.0/doc/install.md @ 147:45360b968bf4

Cap'n Proto v0.6 + build for OSX
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 22 May 2017 10:01:37 +0100
parents
children
comparison
equal deleted inserted replaced
146:206f0eb279b8 147:45360b968bf4
1 ---
2 layout: page
3 title: Installation
4 ---
5
6 # Installation: Tools and C++ Runtime
7
8 The Cap'n Proto tools, including the compiler (which takes `.capnp` files and generates source code
9 for them), are written in C++. Therefore, you must install the C++ package even if your actual
10 development language is something else.
11
12 This package is licensed under the [MIT License](http://opensource.org/licenses/MIT).
13
14 ## Caveats
15
16 <p style="font-size: 125%; font-weight: bold;">Cap'n Proto is in BETA</p>
17
18 <div style="float: right"><a class="groups_link" style="color: #fff"
19 href="https://groups.google.com/group/capnproto-announce">Sign Up for Updates</a></div>
20
21 As of this writing, Cap'n Proto is in beta. The serialization layer is close to feature-complete
22 and we don't anticipate any further changes to the wire format. That said, if you want to use it,
23 you should keep in mind some caveats:
24
25 * **Security:** Cap'n Proto has not yet had a security review. Although Kenton has a background
26 in security and is not aware of any vulnerabilities in the current code, it's likely that there
27 are a few, and [some have been found](https://github.com/sandstorm-io/capnproto/tree/master/security-advisories)
28 in the past. For now, do not accept Cap'n Proto messages from parties you do not trust.
29 * **API Stability:** The Cap'n Proto programming interface may still change in ways that break
30 existing code. Such changes are likely to be minor and should not affect the wire format.
31 * **Performance:** While Cap'n Proto is inherently fast by design, the implementation has not yet
32 undergone serious profiling and optimization. Currently it only beats Protobufs in realistic-ish
33 end-to-end benchmarks by around 2x-5x. We can do better.
34 * **RPC:** The RPC implementation particularly experimental, though it is used heavily by
35 [Sandstorm.io](https://sandstorm.io).
36
37 If you'd like to hack on Cap'n Proto, you should join the
38 [discussion group](https://groups.google.com/group/capnproto)!
39
40 If you'd just like to receive updates as things progress, add yourself to the
41 [announce list](https://groups.google.com/group/capnproto-announce).
42
43 ## Prerequisites
44
45 ### Supported Compilers
46
47 Cap'n Proto makes extensive use of C++11 language features. As a result, it requires a relatively
48 new version of a well-supported compiler. The minimum versions are:
49
50 * GCC 4.8
51 * Clang 3.3
52 * Visual C++ 2015
53
54 If your system's default compiler is older that the above, you will need to install a newer
55 compiler and set the `CXX` environment variable before trying to build Cap'n Proto. For example,
56 after installing GCC 4.8, you could set `CXX=g++-4.8` to use this compiler.
57
58 ### Supported Operating Systems
59
60 In theory, Cap'n Proto should work on any POSIX platform supporting one of the above compilers,
61 as well as on Windows. We test every Cap'n Proto release on the following platforms:
62
63 * Android
64 * Linux
65 * Mac OS X
66 * Windows - Cygwin
67 * Windows - MinGW-w64
68 * Windows - Visual C++
69
70 **Windows users:** Cap'n Proto requires Visual Studio 2015 Update 3 or newer. All runtime features
71 of Cap'n Proto -- including serialization and RPC -- are now supported. (It is still not possible to
72 compile the code generator tool, capnp.exe, using Visual Studio; however, a precompiled copy built
73 with MinGW is provided in the release zip for your convenience.)
74
75 **Mac OS X users:** You must use at least Xcode 5 with the Xcode command-line
76 tools (Xcode menu > Preferences > Downloads). Alternatively, the command-line tools
77 package from [Apple](https://developer.apple.com/downloads/) or compiler builds from
78 [Macports](http://www.macports.org/), [Fink](http://www.finkproject.org/), or
79 [Homebrew](http://brew.sh/) are reported to work.
80
81 ## Installation: Unix
82
83 **From Release Tarball**
84
85 You may download and install the release version of Cap'n Proto like so:
86
87 <pre><code>curl -O <a href="https://capnproto.org/capnproto-c++-0.6.0.tar.gz">https://capnproto.org/capnproto-c++-0.6.0.tar.gz</a>
88 tar zxf capnproto-c++-0.6.0.tar.gz
89 cd capnproto-c++-0.6.0
90 ./configure
91 make -j6 check
92 sudo make install</code></pre>
93
94 This will install `capnp`, the Cap'n Proto command-line tool. It will also install `libcapnp`,
95 `libcapnpc`, and `libkj` in `/usr/local/lib` and headers in `/usr/local/include/capnp` and
96 `/usr/local/include/kj`.
97
98 **From Package Managers**
99
100 Some package managers include Cap'n Proto packages.
101
102 Note: These packages are not maintained by us and are sometimes not up to date with the latest Cap'n Proto release.
103
104 * Debian / Ubuntu: `apt-get install capnproto`
105 * Homebrew (OSX): `brew install capnp`
106
107 **From Git**
108
109 If you download directly from Git, you will need to have the GNU autotools --
110 [autoconf](http://www.gnu.org/software/autoconf/),
111 [automake](http://www.gnu.org/software/automake/), and
112 [libtool](http://www.gnu.org/software/libtool/) -- installed.
113
114 git clone https://github.com/sandstorm-io/capnproto.git
115 cd capnproto/c++
116 autoreconf -i
117 ./configure
118 make -j6 check
119 sudo make install
120
121 ## Installation: Windows
122
123 **From Release Zip**
124
125 1. Download Cap'n Proto Win32 build:
126
127 <pre><a href="https://capnproto.org/capnproto-c++-win32-0.6.0.zip">https://capnproto.org/capnproto-c++-win32-0.6.0.zip</a></pre>
128
129 2. Find `capnp.exe`, `capnpc-c++.exe`, and `capnpc-capnp.exe` under `capnproto-tools-win32-0.6.0` in
130 the zip and copy them somewhere.
131
132 If you don't care about C++ support, you can stop here. The compiler exe can be used with plugins
133 provided by projects implementing Cap'n Proto in other languages.
134
135 If you want to use Cap'n Proto in C++ with Visual Studio, do the following:
136
137 1. Make sure that you are using Visual Studio 2015 or newer, with all updates installed. Cap'n
138 Proto uses C++11 language features that did not work in previous versions of Visual Studio,
139 and the updates include many bug fixes that Cap'n Proto requires.
140
141 2. Install [CMake](http://www.cmake.org/) version 3.1 or later.
142
143 3. Use CMake to generate Visual Studio project files under `capnproto-c++-0.6.0` in the zip file.
144 You can use the CMake UI for this or run this shell command:
145
146 cmake -G "Visual Studio 14 2015"
147
148 (For VS2017, you can use "Visual Studio 15 2017" as the generator name.)
149
150 3. Open the "Cap'n Proto" solution in Visual Studio.
151
152 4. Adjust the project build options (e.g., choice of C++ runtime library, enable/disable exceptions
153 and RTTI) to match the options of the project in which you plan to use Cap'n Proto.
154
155 5. Build the solution (`ALL_BUILD`).
156
157 6. Build the `INSTALL` project to copy the compiled libraries, tools, and header files into
158 `CMAKE_INSTALL_PREFIX`.
159
160 Alternatively, find the compiled `.lib` files in the build directory under
161 `src/{capnp,kj}/{Debug,Release}` and place them somewhere where your project can link against them.
162 Also add the `src` directory to your search path for `#include`s, or copy all the headers to your
163 project's include directory.
164
165 Cap'n Proto can also be built with MinGW or Cygwin, using the Unix/autotools build instructions.
166
167 **From Git**
168
169 The C++ sources are located under `c++` directory in the git repository. The build instructions are
170 otherwise the same as for the release zip.
171