| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 1 | Thrift (Thrift IDL and RPC tool) | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 2 |  | 
 | 3 | Mark Slee (mcslee@facebook.com) | 
 | 4 | Marc Kwiatkowski (marc@facebook.com) | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 5 | Aditya Agarwal (aditya@facebook.com) | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 6 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 7 | Last Modified: 2007-Mar-06 | 
 | 8 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 9 | Thrift is distributed under the Thrift open source software license. | 
 | 10 | Please see the included LICENSE file. | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 11 |  | 
 | 12 | Introduction | 
 | 13 | ============ | 
 | 14 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 15 | Thrift is a lightweight, language-independent software stack with an | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 16 | associated code generation mechanism for RPC. Thrift provides clean | 
 | 17 | abstractions for data transport, data serialization, and application | 
 | 18 | level processing. The code generation system takes a simple definition | 
 | 19 | language as its input and generates code across programming languages that | 
 | 20 | uses the abstracted stack to build interoperable RPC clients and servers. | 
 | 21 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 22 | Thrift is specifically designed to support non-atomic version changes | 
 | 23 | across client and server code. | 
 | 24 |  | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 25 | For more details on Thrift's design and implementation, take a gander at | 
 | 26 | the Thrift whitepaper included in this distribution or at the README files | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 27 | in your particular subdirectory of interest. | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 28 |  | 
 | 29 | Heirarchy | 
 | 30 | ========= | 
 | 31 |  | 
 | 32 | thrift/ | 
 | 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 Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 45 |     rb/ | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 46 |  | 
 | 47 |   test/ | 
 | 48 |  | 
 | 49 |     Contains sample Thrift files and test code across the target programming | 
 | 50 |     languages. | 
 | 51 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 52 |   tutorial/ | 
 | 53 |  | 
 | 54 |     Contains a basic tutorial that will teach you how to develop software | 
 | 55 |     using Thrift. | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 56 |  | 
 | 57 | Requirements | 
 | 58 | ============ | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 59 |  | 
 | 60 | Thrift requires boost shared pointers from boost-1.33.1 or greater, see: | 
 | 61 | http://www.boost.org/libs/smart_ptr/smart_ptr.htm | 
 | 62 |  | 
 | 63 | Some portions of Thrift also depend upon libevent, see: | 
 | 64 | http://monkey.org/~provos/libevent/ | 
 | 65 |  | 
| David Reiss | b72d19f | 2007-09-18 19:46:00 +0000 | [diff] [blame] | 66 | Some portions of Thrift also depend upon zlib, see: | 
 | 67 | http://www.zlib.net/ | 
 | 68 |  | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 69 | These libraries are open source and may be freely obtained, but they are not | 
 | 70 | provided as a part of this distribution. | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 71 |  | 
 | 72 | Resources | 
 | 73 | ========= | 
 | 74 |  | 
 | 75 | More information about Thrift can be obtained on the Thrift webpage at: | 
 | 76 |  | 
 | 77 |      http://developers.facebook.com/thrift | 
 | 78 |  | 
 | 79 | Acknowledgments | 
 | 80 | =============== | 
 | 81 |  | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 82 | Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo. | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 83 |  | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 84 | Installation | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 85 | ============ | 
 | 86 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 87 | If you are building from the first time out of the source repository, you will | 
| David Reiss | b72d19f | 2007-09-18 19:46:00 +0000 | [diff] [blame] | 88 | need to generate the configure scripts.  (This is not necessary if you | 
 | 89 | downloaded a tarball.)  From the top directory, do: | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 90 |  | 
 | 91 | 	./bootstrap.sh | 
 | 92 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 93 | Once the configure scripts are generated, thrift can be configured. | 
 | 94 | From the top directory, do: | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 95 |  | 
 | 96 | 	./configure | 
 | 97 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 98 | You may need to specify the location of the boost files explicitly. | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 99 | If you installed boost in /usr/local, you would run configure as follows: | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 100 |  | 
 | 101 | 	./configure --with-boost=/usr/local | 
 | 102 |  | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 103 | Note that by default the thrift C++ library is typically built with debugging | 
 | 104 | symbols included. If you want to customize these options you should use the | 
 | 105 | CXXFLAGS option in configure, as such: | 
| Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 106 |  | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 107 |         ./configure CXXFLAGS='-g -O2' | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 108 |         ./configure CFLAGS='-g -O2' | 
| David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 109 |         ./configure CPPFLAGS='-DDEBUG_MY_FEATURE' | 
| Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 110 |  | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 111 | Run ./configure --help to see other configuration options | 
 | 112 |  | 
| David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 113 | Please be aware that the Python library will ignore the --prefix option | 
 | 114 | and just install wherever Python's distutils puts it (usually along | 
| David Reiss | d683219 | 2007-09-05 00:47:32 +0000 | [diff] [blame] | 115 | the lines of /usr/lib/pythonX.Y/site-packages/).  If you need to control | 
 | 116 | where the Python modules are installed, set the PY_PREFIX variable. | 
 | 117 | (DESTDIR is respected for Python and C++.) | 
| David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 118 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 119 | Make thrift: | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 120 |  | 
 | 121 | 	make | 
 | 122 |  | 
 | 123 | From the top directory, become superuser and do: | 
 | 124 |  | 
 | 125 | 	make install | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 126 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 127 | Note that some language packages must be installed manually using build tools | 
 | 128 | better suited to those languages (at the time of this writing, this applies | 
 | 129 | to Java, Ruby, PHP). | 
 | 130 |  | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 131 | Look for the README file in the lib/<language>/ folder for more details on the | 
 | 132 | installation of each language library package. |