blob: 3520c01796952047406ec6e1894df103951cb661 [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
Roger Meier16fcad02014-03-16 21:12:11 +01004Last Modified: 2014-03-16
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
Mark Slee227ac2c2007-03-07 05:46:50 +000036Thrift is specifically designed to support non-atomic version changes
37across client and server code.
38
Mark Slee3303f362007-03-05 20:09:37 +000039For more details on Thrift's design and implementation, take a gander at
Roger Meier16fcad02014-03-16 21:12:11 +010040the Thrift whitepaper included in this distribution or at the README.md files
Mark Slee227ac2c2007-03-07 05:46:50 +000041in your particular subdirectory of interest.
Mark Slee3303f362007-03-05 20:09:37 +000042
Roger Meier5aaa0212010-11-04 12:20:05 +000043Hierarchy
Mark Slee3303f362007-03-05 20:09:37 +000044=========
45
46thrift/
47
48 compiler/
49 Contains the Thrift compiler, implemented in C++.
50
51 lib/
52 Contains the Thrift software library implementation, subdivided by
53 language of implementation.
54
55 cpp/
Jens Geyer0853ab62013-12-17 21:38:44 +010056 go/
Mark Slee3303f362007-03-05 20:09:37 +000057 java/
58 php/
59 py/
Mark Slee227ac2c2007-03-07 05:46:50 +000060 rb/
Mark Slee3303f362007-03-05 20:09:37 +000061
62 test/
63
64 Contains sample Thrift files and test code across the target programming
65 languages.
66
Mark Slee227ac2c2007-03-07 05:46:50 +000067 tutorial/
68
69 Contains a basic tutorial that will teach you how to develop software
70 using Thrift.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000071
72Requirements
73============
Mark Slee3303f362007-03-05 20:09:37 +000074
David Reissfc306672009-03-20 07:15:04 +000075See http://wiki.apache.org/thrift/ThriftRequirements for
76an up-to-date list of build requirements.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000077
78Resources
79=========
80
81More information about Thrift can be obtained on the Thrift webpage at:
82
Roger Meier5aaa0212010-11-04 12:20:05 +000083 http://thrift.apache.org
Marc Slemko9de5a5c2006-08-23 22:34:00 +000084
85Acknowledgments
86===============
87
Greg Steinf0d35d22009-01-30 19:10:27 +000088Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo,
89and also by Google's protocol buffers.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000090
Mark Slee54b7ab92007-03-06 00:06:27 +000091Installation
Marc Slemko9de5a5c2006-08-23 22:34:00 +000092============
93
Mark Slee57cc25e2007-02-28 21:43:54 +000094If you are building from the first time out of the source repository, you will
David Reissb72d19f2007-09-18 19:46:00 +000095need to generate the configure scripts. (This is not necessary if you
96downloaded a tarball.) From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +000097
98 ./bootstrap.sh
99
Mark Slee57cc25e2007-02-28 21:43:54 +0000100Once the configure scripts are generated, thrift can be configured.
101From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000102
103 ./configure
104
Mark Slee57cc25e2007-02-28 21:43:54 +0000105You may need to specify the location of the boost files explicitly.
Mark Slee3303f362007-03-05 20:09:37 +0000106If you installed boost in /usr/local, you would run configure as follows:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000107
108 ./configure --with-boost=/usr/local
109
Mark Slee3303f362007-03-05 20:09:37 +0000110Note that by default the thrift C++ library is typically built with debugging
111symbols included. If you want to customize these options you should use the
112CXXFLAGS option in configure, as such:
Mark Slee29050782006-09-29 00:12:30 +0000113
Mark Slee3303f362007-03-05 20:09:37 +0000114 ./configure CXXFLAGS='-g -O2'
Mark Slee57cc25e2007-02-28 21:43:54 +0000115 ./configure CFLAGS='-g -O2'
David Reissaea19c92007-08-29 23:17:32 +0000116 ./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
Mark Slee29050782006-09-29 00:12:30 +0000117
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000118Run ./configure --help to see other configuration options
119
David Reissaea19c92007-08-29 23:17:32 +0000120Please be aware that the Python library will ignore the --prefix option
121and just install wherever Python's distutils puts it (usually along
David Reissd6832192007-09-05 00:47:32 +0000122the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control
123where the Python modules are installed, set the PY_PREFIX variable.
124(DESTDIR is respected for Python and C++.)
David Reissaea19c92007-08-29 23:17:32 +0000125
Mark Slee227ac2c2007-03-07 05:46:50 +0000126Make thrift:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000127
128 make
129
130From the top directory, become superuser and do:
131
132 make install
Mark Slee54b7ab92007-03-06 00:06:27 +0000133
Mark Slee227ac2c2007-03-07 05:46:50 +0000134Note that some language packages must be installed manually using build tools
135better suited to those languages (at the time of this writing, this applies
136to Java, Ruby, PHP).
137
Roger Meier16fcad02014-03-16 21:12:11 +0100138Look for the README.md file in the lib/<language>/ folder for more details on the
Mark Slee54b7ab92007-03-06 00:06:27 +0000139installation of each language library package.
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400140
141Testing
142=======
143
144There are a large number of client library tests that can all be run
145from the top-level directory.
146
147 make -k check
148
149This will make all of the libraries (as necessary), and run through
150the unit tests defined in each of the client libraries. If a single
151language fails, the make check will continue on and provide a synopsis
152at the end.
153
154To run the cross-language test suite, please run:
155
Roger Meier359036a2014-03-05 22:51:18 +0100156 make cross
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400157
158This will run a set of tests that use different language clients and
Jens Geyer0853ab62013-12-17 21:38:44 +0100159servers.