Thrift GeilThings

Thrift - GeilThings

Thrift

From GeilThings

Jump to: navigation, search
Thrift
General
Version 0.9.0
Stable 0.9.0
Function Remote procedure call framework
Scripts

Contents

General

See also

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-devel
yum install boost boost-devel automake libtool flex bison pkgconfig
yum 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 /opt
wget http://sourceforge.net/projects/boost/files/boost/1.48.0/boost_1_48_0.tar.gz/download
tar -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 /opt
sudo wget http://apache.lehtivihrea.org/thrift/${NEWVERSION}/thrift-${NEWVERSION}.tar.gz
sudo tar -zxvf thrift-${NEWVERSION}.tar.gz
cd 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.
make
make install

Installing Thrift under Ubuntu

sudo apt-get install git-core
sudo apt-get install libevent-dev zlib-devel glib2-devel libssl-dev
sudo 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-dev
sudo apt-get install automake flex bison
sudo apt-get install curl
sudo apt-get install ruby ruby-full ruby-dev librspec-ruby rake rubygems libdaemons-ruby libgemplugin-ruby mongrel
sudo apt-get install python-dev python-twisted
sudo apt-get install libbit-vector-perl
sudo apt-get install php5-dev php5-cli
sudo apt-get install erlang-base erlang-eunit erlang-dev
sudo apt-get install golang
sudo apt-get install libglib2.0-dev
sudo apt-get install ghc6 cabal-install libghc6-binary-dev libghc6-network-dev libghc6-http-dev
sudo 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 /opt
sudo wget http://apache.lehtivihrea.org/thrift/${NEWVERSION}/thrift-${NEWVERSION}.tar.gz
sudo tar -zxvf thrift-${NEWVERSION}.tar.gz
cd 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 make
sudo make install
 
sudo ln -s /opt/thrift-${NEWVERSION} /opt/thrift

Upgrade 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=thrift
RAWVERSION=`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 /opt
wget http://apache.lehtivihrea.org/thrift/${NEWVERSION}/thrift-${NEWVERSION}.tar.gz
tar -zxvf thrift-${NEWVERSION}.tar.gz
cd 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/thrift
ln -s /opt/thrift-${NEWVERSION} /opt/thrift

Errors 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 http://mail-archives.apache.org/mod_mbox/thrift-user/201112.mbox/%3C711A2D82-3A2C-494D-8A9A-797D9115B7D5@apache.org%3E
(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 http://mail-archives.apache.org/mod_mbox/thrift-user/201112.mbox/%3C711A2D82-3A2C-494D-8A9A-797D9115B7D5@apache.org%3E
See also: http://stackoverflow.com/questions/1073841/gem-install-mongrel-fails-with-ruby-1-9-1
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 re2c

Building 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.1
cpan
install Bit::Vector

Messages

0.9.0

thrift 0.9.0
 
Building C++ Library ......... : yes
Building C (GLib) Library .... : yes
Building Java Library ........ : yes
Building C# Library .......... : no
Building Python Library ...... : yes
Building Ruby Library ........ : yes
Building Haskell Library ..... : no
Building Perl Library ........ : yes
Building PHP Library ......... : yes
Building Erlang Library ...... : yes
Building Go Library .......... : no
Building 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/erlc

0.8.0

thrift 0.8.0
 
Building code generators ..... :
 
Building C++ Library ......... : yes
Building C (GLib) Library .... : yes
Building Java Library ........ : yes
Building C# Library .......... : no
Building Python Library ...... : yes
Building Ruby Library ........ : no
Building Haskell Library ..... : no
Building Perl Library ........ : yes
Building PHP Library ......... : yes
Building Erlang Library ...... : yes
Building Go Library .......... : no
 
Building TZlibTransport ...... : yes
Building TNonblockingServer .. : yes
 
Using javac .................. : javac
Using java ................... : java
Using 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/erlc

Comments

原文地址:https://www.cnblogs.com/lexus/p/2778275.html