Thrift
From GeilThings
Thrift General 0.9.0 0.9.0 Scripts
Links
Contents
General
- Documentation is either very very sparse, or for the wrong version of Thrift, or whatever.
- Thrift Wiki:
- Thrift: The Missing Guide - Diwaker Gupta:
- An intro to Thrift - Blog from Jayant Kumar:
- Apache Thrift - Quick Tutorial:
- Apache Thrift:
- Version: thrift -version
- Response: Thrift version 0.6.1
- Community forums (Mailing lists):
See also
- Google Protocol Buffers:
Installing Thrift
Installing Thrift under CentOS
# CentOS 5 packages:# http://wiki.apache.org/thrift/GettingCentOS5Packages# automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel # ruby-devel was not installed since Ruby was built from source. # CentOS 5.6, 5.7:yum install gcc-c++ libevent libevent-devel zlib-devel glib2-develyum install boost boost-devel automake libtool flex bison pkgconfigyum install perl-Bit-Vector# CentOS 6.2 has perl-Class-Accessor, CentOS 5.6 does not, see below.# Is perl-Class-Accessor really needed??? The Perl library can be built with Thrift 0.8.0 WITHOUT perl-Class-Accessor.# CentOS 6.2:yum install perl-Class-Accessor### perl-Class-Accessor was not found in CentOS 5.6 repository, so# cpan# install Class::Accessor# exit # Not needed for CentOS 6.2 since CentOS 6.2 has boost 1.41.0:# CentOS 5.6 originally had boost 1.33.1, Thrift 0.6.1 required 1.34.0 for building all tests, so I used boost from source.cd /optwget http://sourceforge.net/projects/boost/files/boost/1.48.0/boost_1_48_0.tar.gz/downloadtar -zxvf boost_1_48_0.tar.gz # Ant is needed for compiling against Java as of Thrift 0.8.0, CentOS 6.2, Java 1.6.31. RAWNEWVERSION=`curl -sd "action=ask&query=[[Thrift]]|%3FStable&format=json" http://www.geilthings.com/api.php` NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'` echo $NEWVERSION cd /optsudo wget http://apache.lehtivihrea.org/thrift/${NEWVERSION}/thrift-${NEWVERSION}.tar.gzsudo tar -zxvf thrift-${NEWVERSION}.tar.gzcd thrift-${NEWVERSION} # I could not compile it against Ruby since "make" gave errors.# CentOS 5.7:./configure --with-boost=/opt/boost_1_48_0 --with-c_glib=yes --without-ruby# CentOS 6.2: ./configure --with-c_glib=yes --without-ruby # See below for errors.makemake installInstalling Thrift under Ubuntu
- Ubuntu 12.04
- See official documentation:
sudo apt-get install git-coresudo apt-get install libevent-dev zlib-devel glib2-devel libssl-devsudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libtool pkg-config g++sudo apt-get install ruby1.8-dev libcommons-lang-java php5-devsudo apt-get install automake flex bisonsudo apt-get install curlsudo apt-get install ruby ruby-full ruby-dev librspec-ruby rake rubygems libdaemons-ruby libgemplugin-ruby mongrelsudo apt-get install python-dev python-twistedsudo apt-get install libbit-vector-perlsudo apt-get install php5-dev php5-clisudo apt-get install erlang-base erlang-eunit erlang-devsudo apt-get install golangsudo apt-get install libglib2.0-devsudo apt-get install ghc6 cabal-install libghc6-binary-dev libghc6-network-dev libghc6-http-devsudo apt-get install ant RAWNEWVERSION=`curl -sd "action=ask&query=[[Thrift]]|%3FStable&format=json" http://www.geilthings.com/api.php` NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'` echo $NEWVERSION cd /optsudo wget http://apache.lehtivihrea.org/thrift/${NEWVERSION}/thrift-${NEWVERSION}.tar.gzsudo tar -zxvf thrift-${NEWVERSION}.tar.gzcd thrift-${NEWVERSION}sudo ./configure --with-c_glib=yes# The file /opt/thrift/config.log can be checked for errors and warnings after running ./configure.sudo makesudo make install sudo ln -s /opt/thrift-${NEWVERSION} /opt/thriftUpgrade Thrift
# Just in case, shut down any thrift-related servers. But this is (October 2012, current versions) actually not needed.# e.g. /opt/hbase/bin/hbase-daemon.sh stop thrift # Check the Requirements, they might have changed: # http://wiki.apache.org/thrift/ThriftRequirements APPNAME=thriftRAWVERSION=`thrift -version`OLDVERSION=${RAWVERSION:15}echo ${OLDVERSION} RAWNEWVERSION=`curl -sd "action=ask&query=[[Thrift]]|%3FStable&format=json" http://www.geilthings.com/api.php` NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'` echo $NEWVERSION # Download Thrift.cd /optwget http://apache.lehtivihrea.org/thrift/${NEWVERSION}/thrift-${NEWVERSION}.tar.gztar -zxvf thrift-${NEWVERSION}.tar.gzcd thrift-${NEWVERSION} # Check that PYTHONHOME is set to the python version that came with the CentOS distribution. # Now configure it:# If the CentOS default "boost" is used, the option --with-boost=/opt/boost_1_48_0 is not needed.# CentOS 5.7:# thrift 0.8.0:# ./configure --with-boost=/opt/boost_1_48_0 --with-c_glib=yes --without-ruby# CentOS 6.2:# thrift 0.8.0:# ./configure --with-c_glib=yes --without-ruby # CentOS 6.3, Thrift 0.9.0, ruby < 1.9.3-p327 (e.g. 1.9.3-p286)./configure --with-c_glib=yes --with-ruby=no # CentOS 6.3, Thrift 0.9.0, ruby >= 1.9.3-p327# HURRA, Ruby working with thrift again!!!!!!!!!!!!!!!!!!!!./configure --with-c_glib=yes # Always "make clean" after finding & correcting some errors in "make", and then "make" again after "make clean".make# make for Thrift 0.8.0 has more undocumented (December 2011) hidden dependencies than Thrift 0.61 or Thrift 0.7; see below for Errors.make install # Check.thrift -version rm -f /opt/thriftln -s /opt/thrift-${NEWVERSION} /opt/thriftErrors Installing Thrift or Upgrading Thrift
This integer is too big: "9876543210987654321"
(Thrift 0.8.0, Erlang R15B, error after "make")
[WARNING:/opt/thrift-0.8.0/test/BrokenConstants.thrift:20] 64-bit constant "68719476736" may not work in all languages. [ERROR:/opt/thrift-0.8.0/test/BrokenConstants.thrift:21] (last token was '9876543210987654321') This integer is too big: "9876543210987654321"Rebar requires version {1,5} or higher of git to process ./rebar get-deps
(Thrift 0.8.0, Erlang R15B, error after "make")
Rebar requires version {1,5} or higher of git to process ./rebar get-deps ==> erl (get-deps) Pulling jsx from {git,"git://github.com/talentdeficit/jsx.git",{tag,"v0.9.0"}} ERROR: Rebar requires version {1,5} or higher of git to process {git, "git://github.com/talentdeficit/jsx.git", {tag, "v0.9.0"}}
- Solution for Errors 1 and 2: Install git; git x86_64 1.7.4.1 1.el5 can be found in the epel repository (December 2011).
- yum install git
- make clean
- make
Cannot load such file -- spec/rake/spectask
(Thrift 0.8.0, Ruby 1.9.3p0 or p125, error after "make")
cannot load such file -- spec/rake/spectask
- Solution: Found in
- (gem install rspec will install rspec2 which does NOT solve the problem)
- gem install rspec -v 1.3.2
- make clean
- make
cannot load such file -- mongrel
(Thrift 0.8.0, Ruby 1.9.3p0 or p125, error after "make") (Thrift 0.9.0, Ruby 1.9.3p286)
/usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mongrel (LoadError)
- Solution: Found in
- See also:
- gem install mongrel --pre
- make clean
- make
Can't locate ExtUtils/MakeMaker.pm in @INC
Can't locate ExtUtils/MakeMaker.pm in @INC
- Solution: yum install perl-ExtUtils-MakeMaker
javadoc Could not create the Java virtual machine
(Thrift 0.8.0, Java 1.6.0.30, error after "make install")
[javadoc] Generating Javadoc [javadoc] Javadoc execution [javadoc] Error occurred during initialization of VM [javadoc] Could not reserve enough space for object heap [javadoc] Could not create the Java virtual machine.
- Solution: Shut down some memory consuming services or databases and re-try.
Building Java Library ........ : no
Building Java Library ........ : no
- Solution: Check that the java jdk used is correct and the same as the java runtime environment. Choose the correct one using "sudo update-alternatives --config java". This error can also be seen checking the file /opt/thrift/config.log, the line appears: Exception in thread "main" java.lang.UnsupportedClassVersionError:
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers
(CentOS 6.3 includes 0.13.5)
- Solution: Install re2c (Tool for generating C-based recognizers from regular expressions)
yum install re2cBuilding Perl Library ........ : no
(CentOS 6.3; Solution only tried with perl 5.16.1)
- Solution: Install the perl module Bit::Vector
perlbrew switch perl-5.16.1cpaninstall Bit::VectorMessages
0.9.0
thrift 0.9.0 Building C++ Library ......... : yesBuilding C (GLib) Library .... : yesBuilding Java Library ........ : yesBuilding C# Library .......... : noBuilding Python Library ...... : yesBuilding Ruby Library ........ : yesBuilding Haskell Library ..... : noBuilding Perl Library ........ : yesBuilding PHP Library ......... : yesBuilding Erlang Library ...... : yesBuilding Go Library .......... : noBuilding D Library ........... : no C++ Library: Build TZlibTransport ...... : yes Build TNonblockingServer .. : yes Build TQTcpServer (Qt) .... : no Java Library: Using javac ............... : javac Using java ................ : java Using ant ................. : /usr/bin/ant Python Library: Using Python .............. : /usr/bin/python PHP Library: Using php-config .......... : /usr/bin/php-config Ruby Library: Using Ruby ................ : /usr/local/bin/ruby Perl Library: Using Perl ................ : /root/perl5/perlbrew/perls/perl-5.16.1/bin/perl Erlang Library: Using erlc ................ : /usr/local/bin/erlc0.8.0
thrift 0.8.0 Building code generators ..... : Building C++ Library ......... : yesBuilding C (GLib) Library .... : yesBuilding Java Library ........ : yesBuilding C# Library .......... : noBuilding Python Library ...... : yesBuilding Ruby Library ........ : noBuilding Haskell Library ..... : noBuilding Perl Library ........ : yesBuilding PHP Library ......... : yesBuilding Erlang Library ...... : yesBuilding Go Library .......... : no Building TZlibTransport ...... : yesBuilding TNonblockingServer .. : yes Using javac .................. : javacUsing java ................... : javaUsing ant .................... : /usr/bin/ant Using Python ................. : /usr/bin/python Using php-config ............. : /usr/bin/php-config Using Perl ................... : /usr/bin/perl Using erlc ................... : /usr/local/bin/erlcComments