add doc/install from website, update README.md

This commit is contained in:
Roger Meier 2014-05-30 14:35:34 +02:00
parent 6848de85b8
commit e9f00cbe64
6 changed files with 296 additions and 8 deletions

View File

@ -72,8 +72,7 @@ thrift/
Requirements
============
See http://wiki.apache.org/thrift/ThriftRequirements for
an up-to-date list of build requirements.
See http://thrift.apache.org/docs/install for an up-to-date list of build requirements.
Resources
=========
@ -95,25 +94,29 @@ If you are building from the first time out of the source repository, you will
need to generate the configure scripts. (This is not necessary if you
downloaded a tarball.) From the top directory, do:
./bootstrap.sh
./bootstrap.sh
Once the configure scripts are generated, thrift can be configured.
From the top directory, do:
./configure
./configure
You may need to specify the location of the boost files explicitly.
If you installed boost in /usr/local, you would run configure as follows:
./configure --with-boost=/usr/local
./configure --with-boost=/usr/local
Note that by default the thrift C++ library is typically built with debugging
symbols included. If you want to customize these options you should use the
CXXFLAGS option in configure, as such:
./configure CXXFLAGS='-g -O2'
./configure CFLAGS='-g -O2'
./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
./configure CXXFLAGS='-g -O2'
./configure CFLAGS='-g -O2'
./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
To enable gcov required options -fprofile-arcs -ftest-coverage enable them:
./configure --enable-coverage
Run ./configure --help to see other configuration options

36
doc/install/README.md Normal file
View File

@ -0,0 +1,36 @@
## Basic requirements
* A relatively POSIX-compliant *NIX system
* Cygwin or MinGW can be used on Windows
* g++ 4.2
* boost 1.53.0
* Runtime libraries for lex and yacc might be needed for the compiler.
## Requirements for building from source
* GNU build tools:
* autoconf 2.65
* automake 1.9
* libtool 1.5.24
* pkg-config autoconf macros (pkg.m4)
* lex and yacc (developed primarily with flex and bison)
* libssl-dev
## Language requirements
These are only required if you choose to build the libraries for the given language
* C++
* Boost 1.53.0
* libevent (optional, to build the nonblocking server)
* zlib (optional)
* Java
* Java 1.7
* Apache Ant
* C#: Mono 1.2.4 (and pkg-config to detect it) or Visual Studio 2005+
* Python 2.6 (including header files for extension modules)
* PHP 5.0 (optionally including header files for extension modules)
* Ruby 1.8
* bundler gem
* Erlang R12 (R11 works but not recommended)
* Perl 5
* Bit::Vector
* Class::Accessor

32
doc/install/centos.md Normal file
View File

@ -0,0 +1,32 @@
---
title: "Centos Install"
kind: doc
---
## CentOS setup
The following command installs the required tools and libraries from the base repository needed to build and install the Apache Thrift compiler on a CentOS6/RHEL6 Linux based system.
sudo yum install automake libtool flex bison pkgconfig gcc-c++
The base version of autoconf installed is presently 2.63, however Apache Thrift requires 2.65. A newer version must be installed from a nonstandard repository. For example:
sudo curl ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/monkeyiq:/centos6updates/CentOS_CentOS-6/noarch/autoconf-2.69-12.2.noarch.rpm > autoconf-2.69-12.2.noarch.rpm
sudo yum install autoconf-2.69-12.2.noarch.rpm
To compile and install the Apache Thrift IDL compiler from the development source you will need to install git, clone the development master, then configure and build the IDL Compiler. For example:
sudo yum install git
git clone https://git-wip-us.apache.org/repos/asf/thrift.git
cd thrift
./bootstrap.sh
./configure --enable-libs=no
make
sudo make install
This will build the compiler and install it on the path: /usr/local/bin/thrift
#### Additional reading
For more information on the requirements see: [Apache Thrift Requirements](/docs/install)
For more information on building and installing Thrift see: [Building from source](/docs/BuildingFromSource)

44
doc/install/debian.md Normal file
View File

@ -0,0 +1,44 @@
---
title: "Ubuntu Install"
kind: doc
---
## Debian or Ubuntu setup
The following command install all the required tools and libraries to build and install the Apache Thrift compiler on a Debian/Ubuntu Linux based system.
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
Then install the Java JDK of your choice. Type **javac** to see a list of available packages, pick the one you prefer and **apt-get install** it.
Debian Lenny Users need some packages from backports
sudo apt-get -t lenny-backports install automake libboost-test-dev
## Optional packages
Some other packages depend on what languages you want Thrift to support.
* Ruby
* ruby-full ruby-dev ruby-rspec rake rubygems libdaemons-ruby libgemplugin-ruby mongrel
* Python
* python-all python-all-dev python-all-dbg
* Perl
* libbit-vector-perl libclass-accessor-class-perl
* Php, install
* php5-dev php5-cli phpunit
* C_glib
* libglib2.0-dev
* Erlang
* erlang-base erlang-eunit erlang-dev
* Csharp
* mono-gmcs mono-devel libmono-system-web2.0-cil nunit nunit-console
* Haskell
* ghc6 cabal-install libghc6-binary-dev libghc6-network-dev libghc6-http-dev
* Thrift Compiler for Windows
* mingw32 mingw32-binutils mingw32-runtime
## Additional reading
For more information on the requirements see: [Apache Thrift Requirements](/docs/install)
For more information on building and installing Thrift see: [Building from source](/docs/BuildingFromSource)

31
doc/install/os_x.md Normal file
View File

@ -0,0 +1,31 @@
---
title: "OS X Install"
kind: doc
---
## OS X Setup
The following command install all the required tools and libraries to build and install the Apache Thrift compiler on a OS X based system.
### Install Boost
Download the boost library from [boost.org](http://www.boost.org) untar compile with
./bootstrap.sh
sudo ./b2 threading=multi address-model=64 variant=release stage install
### Install libevent
Download [libevent](http://monkey.org/~provos/libevent), untar and compile with
./configure --prefix=/usr/local
make
sudo make install
### Building Apache Thrift
Download the latest version of [Apache Thrift](/download), untar and compile with
./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local
## Additional reading
For more information on the requirements see: [Apache Thrift Requirements](/docs/install)
For more information on building and installing Thrift see: [Building from source](/docs/BuildingFromSource)

142
doc/install/windows.md Normal file
View File

@ -0,0 +1,142 @@
---
title: "Windows Install"
kind: doc
---
## Windows Setup
The windows compiler is available as a prebuilt exe available [here](/download)
---
## Windows setup from source
### Basic requirements for win32
Thrift's compiler is written in C++ and designed to be portable, but there are some system requirements:
* Cygwin or MinGW
* [Apache Thrift Requirements](/docs/install)
Thrift's runtime libraries are written in various languages, which are also required for the particular language interface.
### Installing from source
If you are building from the first time out of the source repository, you will need to generate the configure scripts. (This is not necessary if you downloaded a tarball.) From the top directory, do:
./bootstrap.sh
Once the configure scripts are generated, thrift can be configured. From the top directory, do:
export CXXFLAGS="-D PTHREAD_MUTEX_RECURSIVE_NP=PTHREAD_MUTEX_RECURSIVE"
./configure
Setting the CXXFLAGS environmental variable works around compile errors with PTHREAD_MUTEX_RECURSIVE_NP being undeclared, by replacing it with the newer, portable PTHREAD_MUTEX_RECURSIVE. (Tested on cygwin 20100320, Thrift r760184, latest pthread.)
**Optional:** You **may not** be able to make from the root Thrift directory due to errors (see below to resolve). To make the compiler only, change to the compiler directory before running make:
cd compiler/cpp
Now make the thrift compiler (& runtime libraries if make is run from the thrift root directory):
make
make install
Some language packages must be installed manually using build tools better suited to those languages (at the time of this writing, this applies to Java, Ruby, PHP).
Look for the README file in the `lib/<language>/` folder for more details on the installation of each language library package.
### Possible issues with Cygwin install
See also Possible issues with MinGW install.
#### Syntax error in ./configure
The following error occurs for some users when running ./configure:
./configure: line 21183: syntax error near unexpected token `MONO,'
./configure: line 21183: ` PKG_CHECK_MODULES(MONO, mono >= 1.2.6, have_mono=yes, have_mono=no)'
To resolve this, you'll need to find your pkg.m4 (installed by the pkg-config package) file and copy it to the thrift/aclocal directory. From the top-level thrift directory, you can copy the file by running
cp /usr/share/aclocal/pkg.m4 aclocal
Finally, re-run ./bootstrap.sh and ./configure. (Note that pkg.m4 is created by the pkg-config tool. If your /usr/share/aclocal directory doesn't contain the pkg.m4 file, you may not have pkg-config installed.)
#### Installing perl runtime libraries
Sometimes, there will be an error during the install of the perl libraries with chmod.
A workaround is to avoid installing the perl libraries if they are not needed.
If you don't need perl, run configure with --without-perl.
If you need perl, and are happy to manually install it, replace the contents of thrift/lib/perl/Makefile with the following, after building thrift:
TODO
#### Linking to installed C++ runtime libraries
Sometimes, the installed libthrift.a will not link using g++, with linker errors about missing vtables and exceptions for Thrift classes.
A workaround is to link the compiled object files directly from your Thrift build, corresponding to the missing classes.
This can be implemented in a Makefile using the following lines:
THRIFT_O=<path to>/thrift/lib/cpp
LTHRIFT=$(THRIFT_O)/Thrift.o $(THRIFT_O)/TSocket.o $(THRIFT_O)/TBinaryProtocol.o $(THRIFT_O)/TBufferTransports.o
Then linking using $(LTHRIFT) instead of -lthrift.
TODO - diagnose issue further
#### C++ runtime segfault with cygwin 1.7.5-1, g++-4.3.4, fork() and throw
If your thrift C++ programs segfault on throw after fork()ing, compile them with g++-3.
The issue and patch are described on the Cygwin mailing list at http://cygwin.com/ml/cygwin/2010-05/msg00203.html
This issue should be fixed in Cygwin versions after 1.7.5-1, or g++ 4.5.0.
## Installation from Source (No Cygwin dependency)
To compile the Thrift generator & runtime libraries (untested) without the cygwin.dll dependency you need to install MinGW (www.mingw.org). In addition you need to add the following entry to your windows PATH variable.
C:\MINGW\BIN
Next, open compiler/cpp/Makefile.am and add the following line to thrift_CXXFLAGS
-DMINGW -mno-cygwin -lfl
Run bootstrap.sh:
./bootstrap.sh
Make sure you have java in your $PATH variable, if not do(adjust path if necessary):
export PATH=$PATH:"/cygdrive/c/program files/java/jre1.6.0_05/bin"
Run configure - using CXXFLAGS to work around an issue with an old pthreads define (untested on MinGW - works on Cygwin):
export CXXFLAGS="-D PTHREAD_MUTEX_RECURSIVE_NP=PTHREAD_MUTEX_RECURSIVE"
./configure
''Optional:'' To make the compiler only, change to the compiler directory before running make:
cd compiler/cpp
Run make:
mingw32-make.exe
### Possible issues with MinGW install
See also Possible issues with Cygwin install, including the discussion about PTHREAD_MUTEX_RECURSIVE_NP.
#### yywrap is not found
Make sure you add -lfl in your cxxflags in Makefile, also try adding -Lc:/cygwin/libs
#### boost is not found
Try and change the include dir to use the windows path from c like this: Edit compiler/cpp/Makefile, look for the declaration of BOOST_CPPFLAGS, change that line for
BOOST_CPPFLAGS = -Ic:/cygwin/usr/include/boost-1_33_1
#### realpath is not found
add -DMINGW -mno-cygwin to the CXXDEFS variable in Makefile
## Additional reading
For more information on the requirements see: [Apache Thrift Requirements](/docs/install)
For more information on building and installing Thrift see: [Building from source](/docs/BuildingFromSource)