blob: a7ebdf9540b378d7c7c845e6e4d7f457e4670314 [file] [log] [blame] [view]
Roger Meier5aaa0212010-11-04 12:20:05 +00001Apache Thrift
Roger Meier16fcad02014-03-16 21:12:11 +01002=============
Marc Slemko9de5a5c2006-08-23 22:34:00 +00003
James E. King III8d96b3b2018-01-23 19:52:48 -05004Last Modified: 2017-11-11
Marc Slemko9de5a5c2006-08-23 22:34:00 +00005
Bryan Duxburydef30a62009-04-08 00:19:37 +00006License
7=======
8
9Licensed to the Apache Software Foundation (ASF) under one
10or more contributor license agreements. See the NOTICE file
11distributed with this work for additional information
12regarding copyright ownership. The ASF licenses this file
13to you under the Apache License, Version 2.0 (the
14"License"); you may not use this file except in compliance
15with the License. You may obtain a copy of the License at
16
17 http://www.apache.org/licenses/LICENSE-2.0
18
19Unless required by applicable law or agreed to in writing,
20software distributed under the License is distributed on an
21"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22KIND, either express or implied. See the License for the
23specific language governing permissions and limitations
24under the License.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000025
26Introduction
27============
28
Mark Slee57cc25e2007-02-28 21:43:54 +000029Thrift is a lightweight, language-independent software stack with an
Mark Slee3303f362007-03-05 20:09:37 +000030associated code generation mechanism for RPC. Thrift provides clean
31abstractions for data transport, data serialization, and application
32level processing. The code generation system takes a simple definition
33language as its input and generates code across programming languages that
34uses the abstracted stack to build interoperable RPC clients and servers.
35
James E. King, III0ad20bd2017-09-30 15:44:16 -070036![Apache Thrift Layered Architecture](doc/images/thrift-layers.png)
37
38Thrift makes it easy for programs written in different programming
39languages to share data and call remote procedures. With support
40for [over 20 programming languages](LANGUAGES.md), chances are Thrift
41supports the ones that you currently use.
42
Mark Slee227ac2c2007-03-07 05:46:50 +000043Thrift is specifically designed to support non-atomic version changes
44across client and server code.
45
Mark Slee3303f362007-03-05 20:09:37 +000046For more details on Thrift's design and implementation, take a gander at
James E. King, III0ad20bd2017-09-30 15:44:16 -070047the Thrift whitepaper included in this distribution or at the README.md file
Mark Slee227ac2c2007-03-07 05:46:50 +000048in your particular subdirectory of interest.
Mark Slee3303f362007-03-05 20:09:37 +000049
James E. King, III0ad20bd2017-09-30 15:44:16 -070050Project Hierarchy
51=================
Mark Slee3303f362007-03-05 20:09:37 +000052
53thrift/
54
55 compiler/
Randy Abernethyb92f6362015-08-30 10:56:35 -070056
Mark Slee3303f362007-03-05 20:09:37 +000057 Contains the Thrift compiler, implemented in C++.
58
59 lib/
Randy Abernethyb92f6362015-08-30 10:56:35 -070060
Mark Slee3303f362007-03-05 20:09:37 +000061 Contains the Thrift software library implementation, subdivided by
62 language of implementation.
63
64 cpp/
Jens Geyer0853ab62013-12-17 21:38:44 +010065 go/
Mark Slee3303f362007-03-05 20:09:37 +000066 java/
67 php/
68 py/
Mark Slee227ac2c2007-03-07 05:46:50 +000069 rb/
James E. King, III0ad20bd2017-09-30 15:44:16 -070070 ...
Mark Slee3303f362007-03-05 20:09:37 +000071
72 test/
73
74 Contains sample Thrift files and test code across the target programming
75 languages.
76
Mark Slee227ac2c2007-03-07 05:46:50 +000077 tutorial/
78
79 Contains a basic tutorial that will teach you how to develop software
80 using Thrift.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000081
82Requirements
83============
Mark Slee3303f362007-03-05 20:09:37 +000084
Roger Meiere9f00cb2014-05-30 14:35:34 +020085See http://thrift.apache.org/docs/install for an up-to-date list of build requirements.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000086
87Resources
88=========
89
90More information about Thrift can be obtained on the Thrift webpage at:
91
Roger Meier5aaa0212010-11-04 12:20:05 +000092 http://thrift.apache.org
Marc Slemko9de5a5c2006-08-23 22:34:00 +000093
94Acknowledgments
95===============
96
Greg Steinf0d35d22009-01-30 19:10:27 +000097Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo,
98and also by Google's protocol buffers.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000099
Mark Slee54b7ab92007-03-06 00:06:27 +0000100Installation
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000101============
102
Mark Slee57cc25e2007-02-28 21:43:54 +0000103If you are building from the first time out of the source repository, you will
David Reissb72d19f2007-09-18 19:46:00 +0000104need to generate the configure scripts. (This is not necessary if you
105downloaded a tarball.) From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000106
Roger Meiere9f00cb2014-05-30 14:35:34 +0200107 ./bootstrap.sh
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000108
Mark Slee57cc25e2007-02-28 21:43:54 +0000109Once the configure scripts are generated, thrift can be configured.
110From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000111
Roger Meiere9f00cb2014-05-30 14:35:34 +0200112 ./configure
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000113
Mark Slee57cc25e2007-02-28 21:43:54 +0000114You may need to specify the location of the boost files explicitly.
Mark Slee3303f362007-03-05 20:09:37 +0000115If you installed boost in /usr/local, you would run configure as follows:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000116
Roger Meiere9f00cb2014-05-30 14:35:34 +0200117 ./configure --with-boost=/usr/local
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000118
Mark Slee3303f362007-03-05 20:09:37 +0000119Note that by default the thrift C++ library is typically built with debugging
120symbols included. If you want to customize these options you should use the
121CXXFLAGS option in configure, as such:
Mark Slee29050782006-09-29 00:12:30 +0000122
Roger Meiere9f00cb2014-05-30 14:35:34 +0200123 ./configure CXXFLAGS='-g -O2'
124 ./configure CFLAGS='-g -O2'
125 ./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
126
127To enable gcov required options -fprofile-arcs -ftest-coverage enable them:
128
129 ./configure --enable-coverage
Mark Slee29050782006-09-29 00:12:30 +0000130
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000131Run ./configure --help to see other configuration options
132
David Reissaea19c92007-08-29 23:17:32 +0000133Please be aware that the Python library will ignore the --prefix option
134and just install wherever Python's distutils puts it (usually along
David Reissd6832192007-09-05 00:47:32 +0000135the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control
136where the Python modules are installed, set the PY_PREFIX variable.
137(DESTDIR is respected for Python and C++.)
David Reissaea19c92007-08-29 23:17:32 +0000138
Mark Slee227ac2c2007-03-07 05:46:50 +0000139Make thrift:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000140
141 make
142
143From the top directory, become superuser and do:
144
145 make install
Mark Slee54b7ab92007-03-06 00:06:27 +0000146
Mark Slee227ac2c2007-03-07 05:46:50 +0000147Note that some language packages must be installed manually using build tools
148better suited to those languages (at the time of this writing, this applies
149to Java, Ruby, PHP).
150
Roger Meier16fcad02014-03-16 21:12:11 +0100151Look for the README.md file in the lib/<language>/ folder for more details on the
Mark Slee54b7ab92007-03-06 00:06:27 +0000152installation of each language library package.
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400153
154Testing
155=======
156
157There are a large number of client library tests that can all be run
158from the top-level directory.
159
160 make -k check
161
162This will make all of the libraries (as necessary), and run through
163the unit tests defined in each of the client libraries. If a single
164language fails, the make check will continue on and provide a synopsis
165at the end.
166
167To run the cross-language test suite, please run:
168
Roger Meier359036a2014-03-05 22:51:18 +0100169 make cross
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400170
171This will run a set of tests that use different language clients and
Jens Geyer0853ab62013-12-17 21:38:44 +0100172servers.
James E. King, III254e86b2017-10-25 09:02:48 -0400173
James E. King, IIIcfb01302017-11-11 09:39:19 -0500174Development
175===========
176
177To build the same way Travis CI builds the project you should use docker.
178We have [comprehensive building instructions for docker](build/docker/README.md).