Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 1 | Apache Thrift (an Apache Incubator project) |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 2 | |
Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 3 | Last Modified: 2009-Jan-30 |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 4 | |
Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 5 | Thrift is distributed under the Apache License, v2.0. Please see the |
| 6 | included LICENSE file. |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 7 | |
| 8 | Introduction |
| 9 | ============ |
| 10 | |
Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 11 | Thrift is a lightweight, language-independent software stack with an |
Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 12 | associated code generation mechanism for RPC. Thrift provides clean |
| 13 | abstractions for data transport, data serialization, and application |
| 14 | level processing. The code generation system takes a simple definition |
| 15 | language as its input and generates code across programming languages that |
| 16 | uses the abstracted stack to build interoperable RPC clients and servers. |
| 17 | |
Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 18 | Thrift is specifically designed to support non-atomic version changes |
| 19 | across client and server code. |
| 20 | |
Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 21 | For more details on Thrift's design and implementation, take a gander at |
| 22 | the Thrift whitepaper included in this distribution or at the README files |
Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 23 | in your particular subdirectory of interest. |
Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 24 | |
| 25 | Heirarchy |
| 26 | ========= |
| 27 | |
| 28 | thrift/ |
| 29 | |
| 30 | compiler/ |
| 31 | Contains the Thrift compiler, implemented in C++. |
| 32 | |
| 33 | lib/ |
| 34 | Contains the Thrift software library implementation, subdivided by |
| 35 | language of implementation. |
| 36 | |
| 37 | cpp/ |
| 38 | java/ |
| 39 | php/ |
| 40 | py/ |
Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 41 | rb/ |
Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 42 | |
| 43 | test/ |
| 44 | |
| 45 | Contains sample Thrift files and test code across the target programming |
| 46 | languages. |
| 47 | |
Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 48 | tutorial/ |
| 49 | |
| 50 | Contains a basic tutorial that will teach you how to develop software |
| 51 | using Thrift. |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 52 | |
| 53 | Requirements |
| 54 | ============ |
Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 55 | |
David Reiss | fc30667 | 2009-03-20 07:15:04 +0000 | [diff] [blame] | 56 | See http://wiki.apache.org/thrift/ThriftRequirements for |
| 57 | an up-to-date list of build requirements. |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 58 | |
| 59 | Resources |
| 60 | ========= |
| 61 | |
| 62 | More information about Thrift can be obtained on the Thrift webpage at: |
| 63 | |
Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 64 | http://incubator.apache.org/thrift |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 65 | |
| 66 | Acknowledgments |
| 67 | =============== |
| 68 | |
Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 69 | Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo, |
| 70 | and also by Google's protocol buffers. |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 71 | |
Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 72 | Installation |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 73 | ============ |
| 74 | |
Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 75 | 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] | 76 | need to generate the configure scripts. (This is not necessary if you |
| 77 | downloaded a tarball.) From the top directory, do: |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 78 | |
| 79 | ./bootstrap.sh |
| 80 | |
Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 81 | Once the configure scripts are generated, thrift can be configured. |
| 82 | From the top directory, do: |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 83 | |
| 84 | ./configure |
| 85 | |
Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 86 | You may need to specify the location of the boost files explicitly. |
Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 87 | 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] | 88 | |
| 89 | ./configure --with-boost=/usr/local |
| 90 | |
Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 91 | Note that by default the thrift C++ library is typically built with debugging |
| 92 | symbols included. If you want to customize these options you should use the |
| 93 | CXXFLAGS option in configure, as such: |
Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 94 | |
Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 95 | ./configure CXXFLAGS='-g -O2' |
Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 96 | ./configure CFLAGS='-g -O2' |
David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 97 | ./configure CPPFLAGS='-DDEBUG_MY_FEATURE' |
Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 98 | |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 99 | Run ./configure --help to see other configuration options |
| 100 | |
David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 101 | Please be aware that the Python library will ignore the --prefix option |
| 102 | and just install wherever Python's distutils puts it (usually along |
David Reiss | d683219 | 2007-09-05 00:47:32 +0000 | [diff] [blame] | 103 | the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control |
| 104 | where the Python modules are installed, set the PY_PREFIX variable. |
| 105 | (DESTDIR is respected for Python and C++.) |
David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 106 | |
Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 107 | Make thrift: |
Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 108 | |
| 109 | make |
| 110 | |
| 111 | From the top directory, become superuser and do: |
| 112 | |
| 113 | make install |
Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 114 | |
Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 115 | Note that some language packages must be installed manually using build tools |
| 116 | better suited to those languages (at the time of this writing, this applies |
| 117 | to Java, Ruby, PHP). |
| 118 | |
Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 119 | Look for the README file in the lib/<language>/ folder for more details on the |
| 120 | installation of each language library package. |