You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Andrzej <bo...@wp.pl> on 2017/08/21 18:51:55 UTC
How install thrift libraries?
First I tried
sudo apt install thrift-compiler
but it installs only compiler, not jar libs nor C++ libraries.
Next I tried (thrift apache org docs)BuildingFromSource
but bootstrap.sh is now in fb303 directory, not top directory.
I call ./boostrap and ./configure but when try make:
Service.cpp' || echo './'`gen-cpp/FacebookService.cpp
In file included from gen-cpp/FacebookService.cpp:7:0:
gen-cpp/FacebookService.h:10:39: fatal error: thrift/TDispatchProcessor.h:
- no file or directory
How to install? Especially I need C++ libraries.
Re: How install thrift libraries?
Posted by Randy Abernethy <ra...@apache.org>.
I just built the thrift compiler and C++ libs from source on a plain
vanilla Ubuntu 16.04 server install.
Here's a transcript which should give you all the steps you need (including
a look at the dockerfiles that give you all the steps):
user@ubuntu:~$ git clone http://github.com/apache/thrift
Cloning into 'thrift'...
remote: Counting objects: 52757, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 52757 (delta 11), reused 20 (delta 8), pack-reused 52725
Receiving objects: 100% (52757/52757), 19.53 MiB | 495.00 KiB/s, done.
Resolving deltas: 100% (36475/36475), done.
Checking connectivity... done.
user@ubuntu:~$ cd thrift
user@ubuntu:~/thrift$ uname -a
Linux ubuntu 4.4.0-92-generic #115-Ubuntu SMP Thu Aug 10 09:04:33 UTC 2017
x86_64 x86_64 x86_64 GNU/Linux
user@ubuntu:~/thrift$ ls -l build/
total 20
drwxrwxr-x 2 user user 4096 Aug 21 12:00 appveyor
drwxrwxr-x 2 user user 4096 Aug 21 12:00 cmake
drwxrwxr-x 7 user user 4096 Aug 21 12:00 docker
drwxrwxr-x 2 user user 4096 Aug 21 12:00 travis
drwxrwxr-x 4 user user 4096 Aug 21 12:00 wincpp
user@ubuntu:~/thrift$ ls -l build/docker/
total 32
drwxrwxr-x 2 user user 4096 Aug 21 12:00 centos
drwxrwxr-x 2 user user 4096 Aug 21 12:00 centos6
-rwxrwxr-x 1 user user 1420 Aug 21 12:00 check_unmodified.sh
drwxrwxr-x 2 user user 4096 Aug 21 12:00 debian
-rw-rw-r-- 1 user user 633 Aug 21 12:00 README.md
drwxrwxr-x 2 user user 4096 Aug 21 12:00 scripts
drwxrwxr-x 2 user user 4096 Aug 21 12:00 ubuntu
-rw-rw-r-- 1 user user 2021 Aug 21 12:00 Vagrantfile
user@ubuntu:~/thrift$ ls -l build/docker/ubuntu/
total 8
-rw-rw-r-- 1 user user 7392 Aug 21 12:00 Dockerfile
user@ubuntu:~/thrift$ head -73 build/docker/ubuntu/Dockerfile | tail -32
RUN apt-get update && apt-get install -y --no-install-recommends \
`# General dependencies` \
bison \
build-essential \
clang \
cmake \
debhelper \
flex \
ninja-build \
pkg-config \
`# Included in buildpack-deps` \
`# autoconf` \
`# automake` \
`# g++` \
`# git` \
`# libtool` \
`# make`
RUN apt-get install -y --no-install-recommends \
`# C++ dependencies` \
`# libevent and OpenSSL are needed by D too` \
libboost-dev \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-test-dev \
libboost-thread-dev \
libevent-dev \
libssl-dev \
qt5-default \
qtbase5-dev \
qtbase5-dev-tools
user@ubuntu:~/thrift$ sudo apt-get update && sudo apt-get install -y
--no-install-recommends bison build-essential cmake flex pkg-config
autoconf automake g++ git libtool make libboost-dev libssl-dev
...
user@ubuntu:~/thrift$ ./bootstrap.sh
Unescaped left brace in regex is deprecated, passed through in regex;
marked by <-- HERE in m/\${ <-- HERE [^\}]*}/ at /usr/bin/autoscan line 361.
configure.ac:86: installing './compile'
configure.ac:90: installing './config.guess'
configure.ac:90: installing './config.sub'
configure.ac:27: installing './install-sh'
configure.ac:27: installing './missing'
compiler/cpp/Makefile.am: installing './depcomp'
configure.ac: installing './ylwrap'
user@ubuntu:~/thrift$ ./configure --without-python
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
...
thrift 1.0.0-dev
Building Plugin Support ...... : no
Building C++ Library ......... : yes
Building C (GLib) Library .... : no
Building Java Library ........ : no
Building C# Library .......... : no
Building .NET Core Library ... : no
Building Python Library ...... : no
Building Ruby Library ........ : no
Building Haxe Library ........ : no
Building Haskell Library ..... : no
Building Perl Library ........ : no
Building PHP Library ......... : no
Building Dart Library ........ : no
Building Erlang Library ...... : no
Building Go Library .......... : no
Building D Library ........... : no
Building NodeJS Library ...... : no
Building Lua Library ......... : no
Building Rust Library ........ : no
C++ Library:
Build TZlibTransport ...... : yes
Build TNonblockingServer .. : no
Build TQTcpServer (Qt4) ... : no
Build TQTcpServer (Qt5) ... : no
If something is missing that you think should be present,
please skim the output of configure to find the missing
component. Details are present in config.log.
user@ubuntu:~/thrift$
user@ubuntu:~/thrift$ make
make all-recursive
make[1]: Entering directory '/home/user/thrift'
Making all in compiler/cpp
...
libtool: link: g++ -Wall -Wextra -pedantic -g -O2 -std=c++11
-Wno-deprecated-register -o .libs/TutorialClient CppClient.o
-L/usr/lib/x86_64-linux-gnu ./.libs/libtutorialgencpp.a
/home/user/thrift/lib/cpp/.libs/libthrift.so -lssl -lcrypto
../../lib/cpp/.libs/libthrift.so -lrt -lpthread
make[4]: Leaving directory '/home/user/thrift/tutorial/cpp'
make[3]: Leaving directory '/home/user/thrift/tutorial/cpp'
make[3]: Entering directory '/home/user/thrift/tutorial'
../compiler/cpp/thrift --gen html -r ../tutorial/tutorial.thrift
make[3]: Leaving directory '/home/user/thrift/tutorial'
make[2]: Leaving directory '/home/user/thrift/tutorial'
make[2]: Entering directory '/home/user/thrift'
make[2]: Leaving directory '/home/user/thrift'
make[1]: Leaving directory '/home/user/thrift'
user@ubuntu:~/thrift$ sudo make install
Making install in compiler/cpp
...
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
...
make[2]: Leaving directory '/home/user/thrift'
make[1]: Leaving directory '/home/user/thrift'
user@ubuntu:~/thrift$ thrift --version
Thrift version 1.0.0-dev
user@ubuntu:~/thrift$ ls -l /usr/local/lib
total 32996
-rwxr-xr-x 1 root root 8381048 Aug 21 13:52 libthrift-1.0.0-dev.so
-rw-r--r-- 1 root root 21079844 Aug 21 13:52 libthrift.a
-rwxr-xr-x 1 root root 997 Aug 21 13:52 libthrift.la
lrwxrwxrwx 1 root root 22 Aug 21 13:52 libthrift.so ->
libthrift-1.0.0-dev.so
-rwxr-xr-x 1 root root 1319760 Aug 21 13:52 libthriftz-1.0.0-dev.so
-rw-r--r-- 1 root root 2978898 Aug 21 13:52 libthriftz.a
-rwxr-xr-x 1 root root 989 Aug 21 13:52 libthriftz.la
lrwxrwxrwx 1 root root 23 Aug 21 13:52 libthriftz.so ->
libthriftz-1.0.0-dev.so
drwxr-xr-x 2 root root 4096 Aug 21 13:52 pkgconfig
drwxrwsr-x 3 root staff 4096 Aug 4 2016 python3.5
user@ubuntu:~/thrift$
On Mon, Aug 21, 2017 at 11:51 AM, Andrzej <bo...@wp.pl> wrote:
> First I tried
> sudo apt install thrift-compiler
> but it installs only compiler, not jar libs nor C++ libraries.
> Next I tried (thrift apache org docs)BuildingFromSource
> but bootstrap.sh is now in fb303 directory, not top directory.
> I call ./boostrap and ./configure but when try make:
>
> Service.cpp' || echo './'`gen-cpp/FacebookService.cpp
> In file included from gen-cpp/FacebookService.cpp:7:0:
> gen-cpp/FacebookService.h:10:39: fatal error: thrift/TDispatchProcessor.h:
> - no file or directory
>
> How to install? Especially I need C++ libraries.
>
Standard samples: C++: typedef int32_t int
Posted by Andrzej <bo...@wp.pl>.
I have successfully installed Thrift and make samples (thrift-exercises
on github/borneq)
First sample : multiplication with Java I build and run with success.
But If I want compile to C++ it has problem:
typedef i32 int // We can use typedef to get pretty names for the types
we are using
service MultiplicationService
{
int multiply(1:int n1, 2:int n2),
}
compile to:
typedef int32_t int;
it is GCC problem. I can't simply remove "typedef i32 int" from thrift
because thrift need int type.
AW: Invalid method name for thrift2 (HBase)
Posted by Jens Geyer <je...@hotmail.com>.
Hi,
hard to say. Why don't you ask on the HBase lists?
Sent from mobile device, please ignore spelling mistakes.
________________________________
Von: Andrzej
Gesendet: 03.10.2017 16:16
An: user@thrift.apache.org
Betreff: Invalid method name for thrift2 (HBase)
Simple example for thrift1 is OK, but I try thrift2
int main(int argc, char** argv)
{
bool isFramed = false;
boost::shared_ptr<TTransport> socket(new TSocket("localhost", 9090));
boost::shared_ptr<TTransport> transport;
if (isFramed) {
transport.reset(new TFramedTransport(socket));
} else {
transport.reset(new TBufferedTransport(socket));
}
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
THBaseServiceClient client(protocol);
try{
transport->open();
std::cout << "insert..." << std::endl;
TPut tput;
TColumnValue val;
val.family="d";
val.qualifier="col1";
val.value="1";
tput.row = "001";
tput.columnValues.push_back(val);
client.put("btc_addr", tput);
transport->close();
}
catch (const TException &tx) {
std::cerr << "ERROR: " << tx.what() << std::endl;
}
return 0;
}
Is error: Invalid method name for 'put'
btw: Thrift2 is faster than Thrift1?
Invalid method name for thrift2 (HBase)
Posted by Andrzej <bo...@wp.pl>.
Simple example for thrift1 is OK, but I try thrift2
int main(int argc, char** argv)
{
bool isFramed = false;
boost::shared_ptr<TTransport> socket(new TSocket("localhost", 9090));
boost::shared_ptr<TTransport> transport;
if (isFramed) {
transport.reset(new TFramedTransport(socket));
} else {
transport.reset(new TBufferedTransport(socket));
}
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
THBaseServiceClient client(protocol);
try{
transport->open();
std::cout << "insert..." << std::endl;
TPut tput;
TColumnValue val;
val.family="d";
val.qualifier="col1";
val.value="1";
tput.row = "001";
tput.columnValues.push_back(val);
client.put("btc_addr", tput);
transport->close();
}
catch (const TException &tx) {
std::cerr << "ERROR: " << tx.what() << std::endl;
}
return 0;
}
Is error: Invalid method name for 'put'
btw: Thrift2 is faster than Thrift1?
Re: Thrift One and Thrift Two
Posted by Jens Geyer <je...@hotmail.com>.
Hi Andrzej,
the HBASE people are better at this to explain, but AFAIK the "2" protocol
is a newer version of the HBASE Thrift API.
http://hbase.apache.org/0.94/book/thrift.html
Have fun,
JensG
-----Ursprüngliche Nachricht-----
From: Andrzej
Sent: Tuesday, October 3, 2017 7:53 AM
To: user@thrift.apache.org
Subject: Thrift One and Thrift Two
I am beginner. What is difference between:
hbase\hbase-thrift\src\main\resources\org\apache\hadoop\hbase\thrift\Hbase.thrift
and
hbase\hbase-thrift\src\main\resources\org\apache\hadoop\hbase\thrift2\hbase.thrift
?
Thrift One and Thrift Two
Posted by Andrzej <bo...@wp.pl>.
I am beginner. What is difference between:
hbase\hbase-thrift\src\main\resources\org\apache\hadoop\hbase\thrift\Hbase.thrift
and
hbase\hbase-thrift\src\main\resources\org\apache\hadoop\hbase\thrift2\hbase.thrift
?