blob: d09e6e104d0c6600e4e0eca5b9a3b86f979dab1b [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 IIIc7fe3f42018-06-27 11:01:16 -04004Introduction
5============
6
7Thrift is a lightweight, language-independent software stack with an
8associated code generation mechanism for point-to-point RPC. Thrift provides
9clean abstractions for data transport, data serialization, and application
10level processing. The code generation system takes a simple definition
11language as input and generates code across programming languages that
12uses the abstracted stack to build interoperable RPC clients and servers.
13
14![Apache Thrift Layered Architecture](doc/images/thrift-layers.png)
15
16Thrift makes it easy for programs written in different programming
17languages to share data and call remote procedures. With support
18for [25 programming languages](LANGUAGES.md), chances are Thrift
19supports the languages that you currently use.
20
21Thrift is specifically designed to support non-atomic version changes
22across client and server code.
23
24For more details on Thrift's design and implementation, see the Thrift
25whitepaper included in this distribution, or at the README.md file
26in your particular subdirectory of interest.
27
28Status
29======
30
31| Branch | Travis | Appveyor | Coverity Scan | codecov.io | Website |
32| :----- | :----- | :------- | :------------ | :--------- | :------ |
33| [`master`](https://github.com/apache/thrift/tree/master) | [![Build Status](https://travis-ci.org/apache/thrift.svg?branch=master)](https://travis-ci.org/apache/thrift) | [![Build status](https://ci.appveyor.com/api/projects/status/github/apache/thrift?branch=master&svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/thrift/history) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/1345/badge.svg)](https://scan.coverity.com/projects/thrift) | | [![Website](https://img.shields.io/badge/official-website-brightgreen.svg)](https://thrift.apache.org/) |
34
35Releases
36========
37
38Thrift does not maintain a specific release calendar at this time.
39
40We strive to release twice yearly. Download the [current release](http://thrift.apache.org/download).
Marc Slemko9de5a5c2006-08-23 22:34:00 +000041
Bryan Duxburydef30a62009-04-08 00:19:37 +000042License
43=======
44
45Licensed to the Apache Software Foundation (ASF) under one
46or more contributor license agreements. See the NOTICE file
47distributed with this work for additional information
48regarding copyright ownership. The ASF licenses this file
49to you under the Apache License, Version 2.0 (the
50"License"); you may not use this file except in compliance
51with the License. You may obtain a copy of the License at
52
53 http://www.apache.org/licenses/LICENSE-2.0
54
55Unless required by applicable law or agreed to in writing,
56software distributed under the License is distributed on an
57"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
58KIND, either express or implied. See the License for the
59specific language governing permissions and limitations
60under the License.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000061
James E. King, III0ad20bd2017-09-30 15:44:16 -070062Project Hierarchy
63=================
Mark Slee3303f362007-03-05 20:09:37 +000064
65thrift/
66
67 compiler/
Randy Abernethyb92f6362015-08-30 10:56:35 -070068
Mark Slee3303f362007-03-05 20:09:37 +000069 Contains the Thrift compiler, implemented in C++.
70
71 lib/
Randy Abernethyb92f6362015-08-30 10:56:35 -070072
Mark Slee3303f362007-03-05 20:09:37 +000073 Contains the Thrift software library implementation, subdivided by
74 language of implementation.
75
76 cpp/
Jens Geyer0853ab62013-12-17 21:38:44 +010077 go/
Mark Slee3303f362007-03-05 20:09:37 +000078 java/
79 php/
80 py/
Mark Slee227ac2c2007-03-07 05:46:50 +000081 rb/
James E. King, III0ad20bd2017-09-30 15:44:16 -070082 ...
Mark Slee3303f362007-03-05 20:09:37 +000083
84 test/
85
86 Contains sample Thrift files and test code across the target programming
87 languages.
88
Mark Slee227ac2c2007-03-07 05:46:50 +000089 tutorial/
90
91 Contains a basic tutorial that will teach you how to develop software
92 using Thrift.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000093
James E. King IIIc7fe3f42018-06-27 11:01:16 -040094Development
95===========
96
97To build the same way Travis CI builds the project you should use docker.
98We have [comprehensive building instructions for docker](build/docker/README.md).
99
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000100Requirements
101============
Mark Slee3303f362007-03-05 20:09:37 +0000102
James E. King IIIc7fe3f42018-06-27 11:01:16 -0400103See http://thrift.apache.org/docs/install for a list of build requirements (may be stale). Alternatively see the docker build environments for a list of prerequisites.
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000104
105Resources
106=========
107
108More information about Thrift can be obtained on the Thrift webpage at:
109
Roger Meier5aaa0212010-11-04 12:20:05 +0000110 http://thrift.apache.org
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000111
112Acknowledgments
113===============
114
Greg Steinf0d35d22009-01-30 19:10:27 +0000115Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo,
116and also by Google's protocol buffers.
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000117
Mark Slee54b7ab92007-03-06 00:06:27 +0000118Installation
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000119============
120
Mark Slee57cc25e2007-02-28 21:43:54 +0000121If you are building from the first time out of the source repository, you will
David Reissb72d19f2007-09-18 19:46:00 +0000122need to generate the configure scripts. (This is not necessary if you
123downloaded a tarball.) From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000124
Roger Meiere9f00cb2014-05-30 14:35:34 +0200125 ./bootstrap.sh
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000126
Mark Slee57cc25e2007-02-28 21:43:54 +0000127Once the configure scripts are generated, thrift can be configured.
128From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000129
Roger Meiere9f00cb2014-05-30 14:35:34 +0200130 ./configure
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000131
Mark Slee57cc25e2007-02-28 21:43:54 +0000132You may need to specify the location of the boost files explicitly.
Mark Slee3303f362007-03-05 20:09:37 +0000133If you installed boost in /usr/local, you would run configure as follows:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000134
Roger Meiere9f00cb2014-05-30 14:35:34 +0200135 ./configure --with-boost=/usr/local
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000136
Mark Slee3303f362007-03-05 20:09:37 +0000137Note that by default the thrift C++ library is typically built with debugging
138symbols included. If you want to customize these options you should use the
139CXXFLAGS option in configure, as such:
Mark Slee29050782006-09-29 00:12:30 +0000140
Roger Meiere9f00cb2014-05-30 14:35:34 +0200141 ./configure CXXFLAGS='-g -O2'
142 ./configure CFLAGS='-g -O2'
143 ./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
144
145To enable gcov required options -fprofile-arcs -ftest-coverage enable them:
146
147 ./configure --enable-coverage
Mark Slee29050782006-09-29 00:12:30 +0000148
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000149Run ./configure --help to see other configuration options
150
David Reissaea19c92007-08-29 23:17:32 +0000151Please be aware that the Python library will ignore the --prefix option
152and just install wherever Python's distutils puts it (usually along
David Reissd6832192007-09-05 00:47:32 +0000153the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control
154where the Python modules are installed, set the PY_PREFIX variable.
155(DESTDIR is respected for Python and C++.)
David Reissaea19c92007-08-29 23:17:32 +0000156
Mark Slee227ac2c2007-03-07 05:46:50 +0000157Make thrift:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000158
159 make
160
161From the top directory, become superuser and do:
162
163 make install
Mark Slee54b7ab92007-03-06 00:06:27 +0000164
Mark Slee227ac2c2007-03-07 05:46:50 +0000165Note that some language packages must be installed manually using build tools
166better suited to those languages (at the time of this writing, this applies
167to Java, Ruby, PHP).
168
Roger Meier16fcad02014-03-16 21:12:11 +0100169Look for the README.md file in the lib/<language>/ folder for more details on the
Mark Slee54b7ab92007-03-06 00:06:27 +0000170installation of each language library package.
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400171
172Testing
173=======
174
175There are a large number of client library tests that can all be run
176from the top-level directory.
177
178 make -k check
179
180This will make all of the libraries (as necessary), and run through
181the unit tests defined in each of the client libraries. If a single
182language fails, the make check will continue on and provide a synopsis
183at the end.
184
185To run the cross-language test suite, please run:
186
Roger Meier359036a2014-03-05 22:51:18 +0100187 make cross
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400188
189This will run a set of tests that use different language clients and
Jens Geyer0853ab62013-12-17 21:38:44 +0100190servers.
James E. King, III254e86b2017-10-25 09:02:48 -0400191
James E. King, IIIcfb01302017-11-11 09:39:19 -0500192