Author: ra
Date: Thu May 15 05:38:09 2014
New Revision: 1594768
URL: http://svn.apache.org/r1594768
Log:
Centos C++ lib build instructions
Modified:
thrift/cms-site/trunk/content/docs/install/centos.md
Modified: thrift/cms-site/trunk/content/docs/install/centos.md
URL:
http://svn.apache.org/viewvc/thrift/cms-site/trunk/content/docs/install/centos.md?rev=1594768&r1=1594767&r2=1594768&view=diff
==============================================================================
--- thrift/cms-site/trunk/content/docs/install/centos.md (original)
+++ thrift/cms-site/trunk/content/docs/install/centos.md Thu May 15 05:38:09
2014
@@ -25,6 +25,43 @@ To compile and install the Apache Thrift
This will build the compiler and install it on the path: /usr/local/bin/thrift
+### Adding Support for the C++ Library
+
+The Apache Thrift IDL Compiler can generate code for any supported language.
Each language also requires an Apache Thrift support library. These support
libraries must be compiled in compiled languages. To build the Apache Thrift
C++ library, the following support libraries must be installed: Boost, OpenSSL
and ZLib. Optionally support for libevent can be installed to enable the
nonblocking server library. To install the required base packages:
+
+ sudo yum install libevent-devel zlib-devel openssl-devel
+
+Centos currently supplies 4.4.7 as the highest version of gcc. RHEL/Centos
provides a Software Collection facility (scl) which allows newer versions of
development tools to be installed alongside the older versions required by the
system. The following steps install g++ 4.7 and related tools alongside the
base g++ 4.4.7:
+
+ sudo yum install wget
+ sudo wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
-P /etc/yum.repos.d
+ sudo sh -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo'
+ sudo yum install devtoolset-1.1
+ scl enable devtoolset-1.1 bash
+
+The final step runs the Software Collection tool (scl) and launches a bash
shell configured to use the updated tools. You will need to build the Apache
Thrift C++ library and user programs from within the scl shell. For more
information:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Developer_Toolset/1/html-single/Software_Collections_Guide/
+
+The Apache Thrift C++ library also requires a newer version of Boost than that
supplied by the standard Centos repos. Here is an example installing the latest
version of Boost (be sure to install Boost within the scl shell configured for
g++ 4.7):
+
+ wget
http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz
+ tar -xzvf boost_1_55_0.tar.gz
+ cd boost_1_55_0
+ ./bootstrap.sh
+ ./b2 install
+
+With the dependencies installed you can build and install the Apache Thrift
C++ libraries within the scl shell:
+
+ cd ~/thrift
+ ./bootstrap.sh
+ ./configure --with-lua=no
+ make
+ make install
+
+The Apache Thrift C++ libraries will be installed in /usr/local/lib. Once
install Apache Thrift RPC applications written in C++ can be compiled and
linked with commands something like this:
+
+ thrift -gen cpp myService.thrift
+ g++ -Wall -std=c++11 server.cpp gen-cpp/myService.cpp -lthrift
-Wl,-rpath,/usr/local/lib -oserver
+
#### Additional reading
For more information on the requirements see: [Apache Thrift
Requirements](/docs/install)