Thrift source code compilation
Thrfit0.11 version installation
Build an Apache Thrift IDL compiler
Environmental preparation
Yum install libtool libtool-devel libevent libevent-devel flex byacc byacc-devel boost boost-devel bison bison-devel-y
download
Wget https://github.com/apache/thrift/archive/0.11.0.tar.gz
Instruction execution
. / bootstrap.sh
. / configure-enable-libs=no-prefix=/home/test/
Make & & make install
Description-the enable-libs=no switch builds the Apache Thrift IDL compiler only without a lib build
After configure, you can specify the following language libraries to be compiled
-- with-csharp build the C# library [default=yes]
-- with-java build the Java library [default=yes]
-- with-erlang build the Erlang library [default=yes]
-- with-nodejs build the Nodejs library [default=yes]
-- with-lua build the Lua library [default=yes]
-- with-python build the Python library [default=yes]
-- with-perl build the Perl library [default=yes]
-- with-php build the PHP library [default=yes]
-- with-php_extension build the PHP_EXTENSION library [default=yes]
-- with-dart build the DART library [default=yes]
-- with-ruby build the Ruby library [default=yes]
-- with-haskell build the Haskell library [default=yes]
-- with-go build the Go library [default=yes]
Be careful
# when make reports an error, package golang.org/x/net/context: unrecognized import path "golang.org/x/net/context", you can turn off go:
[root@node1 thrift-0.11.0] #. / configure-with-go=no
Thrift C++ dynamic library compilation
Source code directory: thrift-0.11.0/lib/cpp
Only when. / configure-- enable-libs=no-- prefix=/home/test/, has been configured for IDL will the Makefile file be generated based on the Makefile.am file.
Only when make & & make install is executed can the test example of C++ be compiled normally. The error is as follows because the IDL tool thrift has not been generated yet:
Make [1]: Entering directory'/ home/dong/thrift/thrift-0.11.0/lib/cpp/test'
/ home/dong/thrift/thrift-0.11.0/compiler/cpp/thrift-- gen cpp.. / test/AnnotationTest.thrift
Make [1]: / home/dong/thrift/thrift-0.11.0/compiler/cpp/thrift: Command not found
Make [1]: * * [Makefile:1815: gen-cpp/AnnotationTest_types.h] Error 127
Make [1]: Leaving directory'/ home/dong/thrift/thrift-0.11.0/lib/cpp/test'
Make: * [Makefile:1720: all-recursive] Error 1
In fact, the libthrift dynamic library directory has been successfully generated in thrift-0.11.0/lib/cpp/.libs
Library: libthrift-0.11.0.so libthrift.a libthrift.la libthrift.lai libthrift.so
Thrfit0.90 version installation
1) make sure the OpenSSL development package is installed on the system
Rpm-qa | grep openssl
Openssl-libs-1.0.2k-19.el7.x86_64
Openssl-1.0.2k-19.el7.x86_64
Openssl-devel-1.0.2k-19.el7.x86_64
2) No rpm source repository, manual compilation to specify installation
. / configure CPPFLAGS= "- I / home/dong/3thrdparty/openssl-1.0.2j/include" LDFLAGS= "- ldl-L / home/dong/3thrdparty/openssl-1.0.2j/"
Otherwise, there will be a compilation error.
Configure: error: "Error: libcrypto required."