blob: 72062592ea737770946fa039eb4f890157f0f861 [file] [log] [blame]
Mark Slee57cc25e2007-02-28 21:43:54 +00001Thrift (Thrift IDL and RPC tool)
Marc Slemko9de5a5c2006-08-23 22:34:00 +00002
3Mark Slee (mcslee@facebook.com)
4Marc Kwiatkowski (marc@facebook.com)
Mark Slee3303f362007-03-05 20:09:37 +00005Aditya Agarwal (aditya@facebook.com)
Marc Slemko9de5a5c2006-08-23 22:34:00 +00006
Mark Slee227ac2c2007-03-07 05:46:50 +00007Last Modified: 2007-Mar-06
8
Mark Slee57cc25e2007-02-28 21:43:54 +00009Thrift is distributed under the Thrift open source software license.
10Please see the included LICENSE file.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000011
12Introduction
13============
14
Mark Slee57cc25e2007-02-28 21:43:54 +000015Thrift is a lightweight, language-independent software stack with an
Mark Slee3303f362007-03-05 20:09:37 +000016associated code generation mechanism for RPC. Thrift provides clean
17abstractions for data transport, data serialization, and application
18level processing. The code generation system takes a simple definition
19language as its input and generates code across programming languages that
20uses the abstracted stack to build interoperable RPC clients and servers.
21
Mark Slee227ac2c2007-03-07 05:46:50 +000022Thrift is specifically designed to support non-atomic version changes
23across client and server code.
24
Mark Slee3303f362007-03-05 20:09:37 +000025For more details on Thrift's design and implementation, take a gander at
26the Thrift whitepaper included in this distribution or at the README files
Mark Slee227ac2c2007-03-07 05:46:50 +000027in your particular subdirectory of interest.
Mark Slee3303f362007-03-05 20:09:37 +000028
29Heirarchy
30=========
31
32thrift/
33
34 compiler/
35 Contains the Thrift compiler, implemented in C++.
36
37 lib/
38 Contains the Thrift software library implementation, subdivided by
39 language of implementation.
40
41 cpp/
42 java/
43 php/
44 py/
Mark Slee227ac2c2007-03-07 05:46:50 +000045 rb/
Mark Slee3303f362007-03-05 20:09:37 +000046
47 test/
48
49 Contains sample Thrift files and test code across the target programming
50 languages.
51
Mark Slee227ac2c2007-03-07 05:46:50 +000052 tutorial/
53
54 Contains a basic tutorial that will teach you how to develop software
55 using Thrift.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000056
57Requirements
58============
Mark Slee3303f362007-03-05 20:09:37 +000059
60Thrift requires boost shared pointers from boost-1.33.1 or greater, see:
61http://www.boost.org/libs/smart_ptr/smart_ptr.htm
62
63Some portions of Thrift also depend upon libevent, see:
64http://monkey.org/~provos/libevent/
65
David Reissb72d19f2007-09-18 19:46:00 +000066Some portions of Thrift also depend upon zlib, see:
67http://www.zlib.net/
68
Mark Slee3303f362007-03-05 20:09:37 +000069These libraries are open source and may be freely obtained, but they are not
70provided as a part of this distribution.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000071
72Resources
73=========
74
75More information about Thrift can be obtained on the Thrift webpage at:
76
77 http://developers.facebook.com/thrift
78
79Acknowledgments
80===============
81
Mark Slee54b7ab92007-03-06 00:06:27 +000082Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000083
Mark Slee54b7ab92007-03-06 00:06:27 +000084Installation
Marc Slemko9de5a5c2006-08-23 22:34:00 +000085============
86
Mark Slee57cc25e2007-02-28 21:43:54 +000087If you are building from the first time out of the source repository, you will
David Reissb72d19f2007-09-18 19:46:00 +000088need to generate the configure scripts. (This is not necessary if you
89downloaded a tarball.) From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +000090
91 ./bootstrap.sh
92
Mark Slee57cc25e2007-02-28 21:43:54 +000093Once the configure scripts are generated, thrift can be configured.
94From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +000095
96 ./configure
97
Mark Slee57cc25e2007-02-28 21:43:54 +000098You may need to specify the location of the boost files explicitly.
Mark Slee3303f362007-03-05 20:09:37 +000099If you installed boost in /usr/local, you would run configure as follows:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000100
101 ./configure --with-boost=/usr/local
102
Mark Slee3303f362007-03-05 20:09:37 +0000103Note that by default the thrift C++ library is typically built with debugging
104symbols included. If you want to customize these options you should use the
105CXXFLAGS option in configure, as such:
Mark Slee29050782006-09-29 00:12:30 +0000106
Mark Slee3303f362007-03-05 20:09:37 +0000107 ./configure CXXFLAGS='-g -O2'
Mark Slee57cc25e2007-02-28 21:43:54 +0000108 ./configure CFLAGS='-g -O2'
David Reissaea19c92007-08-29 23:17:32 +0000109 ./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
Mark Slee29050782006-09-29 00:12:30 +0000110
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000111Run ./configure --help to see other configuration options
112
David Reissaea19c92007-08-29 23:17:32 +0000113Please be aware that the Python library will ignore the --prefix option
114and just install wherever Python's distutils puts it (usually along
David Reissd6832192007-09-05 00:47:32 +0000115the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control
116where the Python modules are installed, set the PY_PREFIX variable.
117(DESTDIR is respected for Python and C++.)
David Reissaea19c92007-08-29 23:17:32 +0000118
Mark Slee227ac2c2007-03-07 05:46:50 +0000119Make thrift:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000120
121 make
122
123From the top directory, become superuser and do:
124
125 make install
Mark Slee54b7ab92007-03-06 00:06:27 +0000126
Mark Slee227ac2c2007-03-07 05:46:50 +0000127Note that some language packages must be installed manually using build tools
128better suited to those languages (at the time of this writing, this applies
129to Java, Ruby, PHP).
130
Mark Slee54b7ab92007-03-06 00:06:27 +0000131Look for the README file in the lib/<language>/ folder for more details on the
132installation of each language library package.