blob: b7ad4e99b8b98bac09f1adf1ef629a4f993522ab [file] [log] [blame]
Roger Meier5aaa0212010-11-04 12:20:05 +00001Apache Thrift
Marc Slemko9de5a5c2006-08-23 22:34:00 +00002
Jens Geyer0853ab62013-12-17 21:38:44 +01003Last Modified: 2013-Dec-17
Marc Slemko9de5a5c2006-08-23 22:34:00 +00004
Bryan Duxburydef30a62009-04-08 00:19:37 +00005License
6=======
7
8Licensed to the Apache Software Foundation (ASF) under one
9or more contributor license agreements. See the NOTICE file
10distributed with this work for additional information
11regarding copyright ownership. The ASF licenses this file
12to you under the Apache License, Version 2.0 (the
13"License"); you may not use this file except in compliance
14with the License. You may obtain a copy of the License at
15
16 http://www.apache.org/licenses/LICENSE-2.0
17
18Unless required by applicable law or agreed to in writing,
19software distributed under the License is distributed on an
20"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21KIND, either express or implied. See the License for the
22specific language governing permissions and limitations
23under the License.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000024
25Introduction
26============
27
Mark Slee57cc25e2007-02-28 21:43:54 +000028Thrift is a lightweight, language-independent software stack with an
Mark Slee3303f362007-03-05 20:09:37 +000029associated code generation mechanism for RPC. Thrift provides clean
30abstractions for data transport, data serialization, and application
31level processing. The code generation system takes a simple definition
32language as its input and generates code across programming languages that
33uses the abstracted stack to build interoperable RPC clients and servers.
34
Mark Slee227ac2c2007-03-07 05:46:50 +000035Thrift is specifically designed to support non-atomic version changes
36across client and server code.
37
Mark Slee3303f362007-03-05 20:09:37 +000038For more details on Thrift's design and implementation, take a gander at
39the Thrift whitepaper included in this distribution or at the README files
Mark Slee227ac2c2007-03-07 05:46:50 +000040in your particular subdirectory of interest.
Mark Slee3303f362007-03-05 20:09:37 +000041
Roger Meier5aaa0212010-11-04 12:20:05 +000042Hierarchy
Mark Slee3303f362007-03-05 20:09:37 +000043=========
44
45thrift/
46
47 compiler/
48 Contains the Thrift compiler, implemented in C++.
49
50 lib/
51 Contains the Thrift software library implementation, subdivided by
52 language of implementation.
53
54 cpp/
Jens Geyer0853ab62013-12-17 21:38:44 +010055 go/
Mark Slee3303f362007-03-05 20:09:37 +000056 java/
57 php/
58 py/
Mark Slee227ac2c2007-03-07 05:46:50 +000059 rb/
Mark Slee3303f362007-03-05 20:09:37 +000060
61 test/
62
63 Contains sample Thrift files and test code across the target programming
64 languages.
65
Mark Slee227ac2c2007-03-07 05:46:50 +000066 tutorial/
67
68 Contains a basic tutorial that will teach you how to develop software
69 using Thrift.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000070
71Requirements
72============
Mark Slee3303f362007-03-05 20:09:37 +000073
David Reissfc306672009-03-20 07:15:04 +000074See http://wiki.apache.org/thrift/ThriftRequirements for
75an up-to-date list of build requirements.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000076
77Resources
78=========
79
80More information about Thrift can be obtained on the Thrift webpage at:
81
Roger Meier5aaa0212010-11-04 12:20:05 +000082 http://thrift.apache.org
Marc Slemko9de5a5c2006-08-23 22:34:00 +000083
84Acknowledgments
85===============
86
Greg Steinf0d35d22009-01-30 19:10:27 +000087Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo,
88and also by Google's protocol buffers.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000089
Mark Slee54b7ab92007-03-06 00:06:27 +000090Installation
Marc Slemko9de5a5c2006-08-23 22:34:00 +000091============
92
Mark Slee57cc25e2007-02-28 21:43:54 +000093If you are building from the first time out of the source repository, you will
David Reissb72d19f2007-09-18 19:46:00 +000094need to generate the configure scripts. (This is not necessary if you
95downloaded a tarball.) From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +000096
97 ./bootstrap.sh
98
Mark Slee57cc25e2007-02-28 21:43:54 +000099Once the configure scripts are generated, thrift can be configured.
100From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000101
102 ./configure
103
Mark Slee57cc25e2007-02-28 21:43:54 +0000104You may need to specify the location of the boost files explicitly.
Mark Slee3303f362007-03-05 20:09:37 +0000105If you installed boost in /usr/local, you would run configure as follows:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000106
107 ./configure --with-boost=/usr/local
108
Mark Slee3303f362007-03-05 20:09:37 +0000109Note that by default the thrift C++ library is typically built with debugging
110symbols included. If you want to customize these options you should use the
111CXXFLAGS option in configure, as such:
Mark Slee29050782006-09-29 00:12:30 +0000112
Mark Slee3303f362007-03-05 20:09:37 +0000113 ./configure CXXFLAGS='-g -O2'
Mark Slee57cc25e2007-02-28 21:43:54 +0000114 ./configure CFLAGS='-g -O2'
David Reissaea19c92007-08-29 23:17:32 +0000115 ./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
Mark Slee29050782006-09-29 00:12:30 +0000116
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000117Run ./configure --help to see other configuration options
118
David Reissaea19c92007-08-29 23:17:32 +0000119Please be aware that the Python library will ignore the --prefix option
120and just install wherever Python's distutils puts it (usually along
David Reissd6832192007-09-05 00:47:32 +0000121the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control
122where the Python modules are installed, set the PY_PREFIX variable.
123(DESTDIR is respected for Python and C++.)
David Reissaea19c92007-08-29 23:17:32 +0000124
Mark Slee227ac2c2007-03-07 05:46:50 +0000125Make thrift:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000126
127 make
128
129From the top directory, become superuser and do:
130
131 make install
Mark Slee54b7ab92007-03-06 00:06:27 +0000132
Mark Slee227ac2c2007-03-07 05:46:50 +0000133Note that some language packages must be installed manually using build tools
134better suited to those languages (at the time of this writing, this applies
135to Java, Ruby, PHP).
136
Mark Slee54b7ab92007-03-06 00:06:27 +0000137Look for the README file in the lib/<language>/ folder for more details on the
138installation of each language library package.
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400139
140Testing
141=======
142
143There are a large number of client library tests that can all be run
144from the top-level directory.
145
146 make -k check
147
148This will make all of the libraries (as necessary), and run through
149the unit tests defined in each of the client libraries. If a single
150language fails, the make check will continue on and provide a synopsis
151at the end.
152
153To run the cross-language test suite, please run:
154
155 sh test/test.sh
156
157This will run a set of tests that use different language clients and
Jens Geyer0853ab62013-12-17 21:38:44 +0100158servers.