按照 https://syslint.com/blog/tutorial/how-to-install-apache-thrift-on-ubuntu-14-04/ 进行,

编译时出现错误

make[4]: Entering directory '/home/lds/mapkeeper/thrift-0.9.3/lib/cpp'
/bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift -I/usr/include -I./src -D__STDC_LIMIT_MACROS -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/x86_64-linux-gnu/qt5 -fPIC -Wall -Wextra -pedantic -g -O2 -std=c++11 -MT src/thrift/qt/libthriftqt5_la-moc__TQTcpServer.lo -MD -MP -MF src/thrift/qt/.deps/libthriftqt5_la-moc__TQTcpServer.Tpo -c -o src/thrift/qt/libthriftqt5_la-moc__TQTcpServer.lo `test -f 'src/thrift/qt/moc__TQTcpServer.cpp' || echo './'`src/thrift/qt/moc__TQTcpServer.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift -I/usr/include -I./src -D__STDC_LIMIT_MACROS -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/x86_64-linux-gnu/qt5 -fPIC -Wall -Wextra -pedantic -g -O2 -std=c++11 -MT src/thrift/qt/libthriftqt5_la-moc__TQTcpServer.lo -MD -MP -MF src/thrift/qt/.deps/libthriftqt5_la-moc__TQTcpServer.Tpo -c src/thrift/qt/moc__TQTcpServer.cpp -fPIC -DPIC -o src/thrift/qt/.libs/libthriftqt5_la-moc__TQTcpServer.o
src/thrift/qt/moc__TQTcpServer.cpp:13:2: error: #error "This file was generated using the moc from 4.8.7. It"
#error "This file was generated using the moc from 4.8.7. It"
^
src/thrift/qt/moc__TQTcpServer.cpp:14:2: error: #error "cannot be used with the include files from this version of Qt."
#error "cannot be used with the include files from this version of Qt."
^
src/thrift/qt/moc__TQTcpServer.cpp:15:2: error: #error "(The moc has changed too much.)"
#error "(The moc has changed too much.)"
^
src/thrift/qt/moc__TQTcpServer.cpp:61:7: error: 'QMetaObjectExtraData' does not name a type
const QMetaObjectExtraData apache::thrift::async::TQTcpServer::staticMetaObjectExtraData = {
^
src/thrift/qt/moc__TQTcpServer.cpp:63:2: warning: extra ';' [-Wpedantic]
};
^
src/thrift/qt/moc__TQTcpServer.cpp:67:57: error: 'staticMetaObjectExtraData' was not declared in this scope
qt_meta_data_apache__thrift__async__TQTcpServer, &staticMetaObjectExtraData }
^
src/thrift/qt/moc__TQTcpServer.cpp: In member function 'virtual const QMetaObject* apache::thrift::async::TQTcpServer::metaObject() const':
src/thrift/qt/moc__TQTcpServer.cpp:76:71: error: conditional expression between distinct pointer types 'QDynamicMetaObjectData*' and 'const QMetaObject*' lacks a cast
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
^

Makefile:1351: recipe for target 'src/thrift/qt/libthriftqt5_la-moc__TQTcpServer.lo' failed
make[4]: *** [src/thrift/qt/libthriftqt5_la-moc__TQTcpServer.lo] Error 1
make[4]: Leaving directory '/home/lds/mapkeeper/thrift-0.9.3/lib/cpp'
Makefile:1574: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/lds/mapkeeper/thrift-0.9.3/lib/cpp'
Makefile:538: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/lds/mapkeeper/thrift-0.9.3/lib'
Makefile:609: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/lds/mapkeeper/thrift-0.9.3'
Makefile:530: recipe for target 'all' failed
make: *** [all] Error 2

后来下载了thrift 10 ,还是这样

经过查找确认,是qt版本的问题,qt4是默认的版本,根据qt官网介绍装好qt5以后,仍然是这错误。继续确认,使用qmake -v 发现qt还是4的版本。卸载qt4后,运行qmake 出现错误。根据 https://stackoverflow.com/questions/39735998/make-qmake-use-qt5-by-default, 使用 export QT_SELECT=5 ,发现 qmake -v变为5的版本了。在thrift目录make clean,./configure, make

qt的错误没有了。

然后编译成功。 但是发现 thrift可以直接通过apt-install 安装。

也许ubuntu默认就带了thrift 0.9

2017.8.24

(1)按照 http://blog.csdn.net/szyjsj/article/details/69567757 下载thrift 0.8,安装时出现

rake abort!

LoadError: cannot load such file -- spec/rake/spectask

错误。

(2) 使用apt-get 安装,安装的是thrift 0.9.1 ,安装成功后,/usr/local/include/thrift 下没有 Thrift.h ,具体就是 /usr/local/include/thrift 下没有。 进入mapkeeper 的thrift目录make时就会出现

apkeeper_types.h:10:27: fatal error: thrift/Thrift.h: No such file or directory

错误。

(3) 按照 https://stackoverflow.com/questions/38077740/error-no-such-file-or-directory-occurs-when-using-thrift-c-to-connect-hbase 下载0.9.2,成功编译,成功安装。

    而且此时,/usr/local/include/thrift 有   Thrift.h 了。

    进入mapkeeper的thrift目录,运行make,没有报找不到文件错误了。

gen-cpp貌似成功了,里面多了很多新文件,

lds@DL:~/mapkeeper/mapkeeper/thrift$ ls *cpp
libmapkeeper.a Makefile mapkeeper_constants.h MapKeeper.cpp MapKeeper.o mapkeeper_types.cpp mapkeeper_types.o
libmapkeeper.so mapkeeper_constants.cpp mapkeeper_constants.o MapKeeper.h MapKeeper_server.skeleton.cpp mapkeeper_types.h

但是gen-java在下载了很多文件后出错了。全是找不到符号错误。

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/lds/mapkeeper/mapkeeper/thrift/gen-java/target/generated-sources/thrift/com/yahoo/mapkeeper/MapKeeper.java:[1124,84] error: cannot find symbol

[ERROR]  package org.apache.thrift

(4) 再次根据 http://blog.csdn.net/szyjsj/article/details/69567757 中对java进行安装,

  • sudo add-apt-repository ppa:webupd8team/java
  • sudo apt-get update
sudo apt-get install oracle-java7-installer
发现oracle-java7-installer 无法下载,然后尝试 oracle-java8-installer,下载了很多,但是最后不知道为什么又自动进行7的安装而且失败。但是貌似8已经安装好了,

lds@DL:~$ ls /usr/lib/jvm/
default-java java-1.8.0-openjdk-amd64 java-7-oracle java-8-openjdk-amd64 java-8-oracle

然后按照8安装结束的提示 运行了 sudo apt install oracle-java8-set-default

然后发现 $JAVA_HOME 已经被全局设置为了 /usr/lib/jvm/java-8-oracle

最后,再次去mapkeeper的thrift目录下运行make,然而,结果还是那样。

(5) 我认为leveldb用不到java,于是就不管了,直接去leveldb目录下,按照https://github.com/m1ch1/mapkeeper/tree/master/leveldb, 将leveldb的相关文件拷贝到了系统路径下。我认为boost肯定已经安装了(经验证,boost版本是1_58)。

运行make后,出现 错误

/usr/bin/ld: /tmp/ccXW9tJO.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
//usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

根据 https://github.com/uzh-rpg/rpg_svo/issues/19 添加了

-lboost_system 后,又出现 /usr/bin/ld: /usr/local/lib/libleveldb.a(port_posix.o): undefined reference to symbol 'pthread_once@@GLIBC_2.2.5'

按照 https://www.linuxquestions.org/questions/linux-software-2/undefined-reference-to-symbol-%27pthread_once%40%40glibc_2-2-5%27-4175421447/,添加了

-L/lib64 -lpthread

说“durations” 未定义,这个好解决,因为这是我在db_bench里定义的。解决办法是使用原版的leveldb。

但是又说

/usr/local/lib/libleveldb.a(table_builder.o): In function `leveldb::TableBuilder::WriteBlock(leveldb::BlockBuilder*, leveldb::BlockHandle*)':
table_builder.cc:(.text+0x7a9): undefined reference to `snappy::MaxCompressedLength(unsigned long)'
table_builder.cc:(.text+0x7d6): undefined reference to `snappy::RawCompress(char const*, unsigned long, char*, unsigned long*)'
/usr/local/lib/libleveldb.a(format.o): In function `leveldb::ReadBlock(leveldb::RandomAccessFile*, leveldb::ReadOptions const&, leveldb::BlockHandle const&, leveldb::BlockContents*)':
format.cc:(.text+0x43a): undefined reference to `snappy::GetUncompressedLength(char const*, unsigned long, unsigned long*)'
format.cc:(.text+0x5c0): undefined reference to `snappy::RawUncompress(char const*, unsigned long, char*)'

好吧,明天再看。

2017.8.25

(1) 继续上面的(5),使用最新版的leveldb,仍然有此问题。

按照 https://github.com/freeminer/freeminer/pull/41/files 装了这些包,仍然有此问题。事实上 libsnappy-dev 包已经存在了。

按照 https://github.com/0x00A/ldb/issues/48 添加-lsnappy 不能解决,remove libsnappy-dev 也不能解决。

很多地方都认为是 libsnappy 没有被连接,有一个csdn的帖子用的是federa,他用yum装了 libsnappy-dev 然后 -lsnappy 就解决了,但是在ubuntu下貌似行,另外上面的连接里还有人说ubuntu14不需要装 libsnappy-dev,但是我remove后make的错误明显表明 libsnappy-dev没有安装。

但是有一个关键的发现:(a)如果移除 libsnappy-dev,出现正常错误,即undefined reference;(2)移除 libsnappy-dev后,Makefile里加上 -lsnappy,则出现 /usr/bin/ld: cannot find -lsnappy;(c)装上 libsnappy-dev,加上 -lsnappy,出现正常错误,即undefined reference。

从(c)和(b)似乎可以看出, -lsnappy是被链接了的,但是链接上的snappy似乎没有定义MaxCompressedLength这些变量。

编译Thrift的更多相关文章

  1. 编译Thrift支持golang

    本文已经是很久以前的文章了,也不知道新版本thrift如何 Thrift是一个跨语言的服务部署框架,Thrift通过一个中间语言(IDL, 接口定义语言)来定义RPC的接口和数据类型,然后通过一个编译 ...

  2. 记录Mac OS下编译Thrift库

    方法一:brew管理工具安装Homebrew是Mac开发包管理工具,类似于Linux的apt-get之类的,实它相当于开发软件界的 Appstore.借助该管理工具,可以自动化地安装软件包,它会自动安 ...

  3. 编译thrift外篇-关于默认链接包-(使用mapkeeper运行leveldb成功)

    根据 https://stackoverflow.com/questions/9922949/how-to-print-the-ldlinker-search-path 使用 ldconfig -v ...

  4. thrift 服务端linux C ++ 与客户端 windows python 环境配置(thrift 自带tutorial为例)

    关于Thrift文档化的确是做的不好.摸索了很久才终于把跨linux与windows跨C++与python语言的配置成功完成.以下是步骤: 1)                 Linux下环境配置 ...

  5. thrift笔记

    Thrift tutorial 演示 python服务端与客户端本文的开发环境是windows 7 + python2.7.3Thrift官方主页:http://thrift.apache.org/先 ...

  6. Thrift 的原理和使用

    thrift 的原理和使用 Thrift 架构 Thrift是一个跨语言的服务部署框架,最初由Facebook于2007年开发,2008年进入Apache开源项目.Thrift通过IDL(Interf ...

  7. Thrift 个人实战--Thrift 的序列化机制

    前言: Thrift作为Facebook开源的RPC框架, 通过IDL中间语言, 并借助代码生成引擎生成各种主流语言的rpc框架服务端/客户端代码. 不过Thrift的实现, 简单使用离实际生产环境还 ...

  8. Thrift在Windows及Linux平台下的安装和使用示例

    本文章也同时发表在个人博客Thrift在Windows及Linux平台下的安装和使用示例上. thrift介绍 Apache Thrift 是 Facebook 实现的一种高效的.支持多种编程语言的R ...

  9. Win7+VS2013初试Thrift

    win7环境下VS2013编译boost_1_58_0步骤: 官网下载boost_1_58_0(直接下载),解压 cmd窗口cd到boost_1_58_0,执行bootstrap.bat cmd窗口获 ...

随机推荐

  1. Excel文件处理Demo

    1.BLL业务逻辑代码 /// <summary> /// 处理“店铺竞品销售数据”导入文件 /// </summary> /// <param name="f ...

  2. TensorFlow 之 高层封装slim,tflearn,keras

    tensorflow资源整合 使用原生态TensorFlow API来实现各种不同的神经网络结构.虽然原生态的TensorFlow API可以很灵活的支持不同的神经网络结构,但是其代码相对比较冗长,写 ...

  3. 记一次CDH修改IP

    因机房服务器搬迁,需要修改CDH ip ,集群中有6台服务器. 其中配置了ldap,其中卡在了ldap中的坑太深,所以记录一下. 一.服务器IP等地址修改 1.首先在安装cloudera-manage ...

  4. VUE高仿饿了么app开发思维导图

    来自互联网 文章来源:刘俊涛的博客 地址:http://www.cnblogs.com/lovebing

  5. MySQL:unknown variable &#39;master-host=masterIP&#39; [ERROR] Aborting

    <span style="font-size:18px;">120401 15:45:44 [ERROR] C:\Program Files\MySQL\MySQL S ...

  6. Crtmp Server 几个关键流程

    最近在阅读Crtmp Sever 源码,有些关键流程记录下来,以备以后查阅.假设rtmp播放地址是"rtmp://127.0.0.1/live/mystream live=1" 1 ...

  7. 【转载】Web Service和WCF的到底有什么区别

    [1]Web Service:严格来说是行业标准,也就是Web Service 规范,也称作WS-*规范,既不是框架,也不是技术. 它有一套完成的规范体系标准,而且在持续不断的更新完善中. 它使用XM ...

  8. linux之return和exit引发的大问题(vfork和fork)

    在coolshell.cn上看到的一个问题.为此拿来研究一下. 首先 看看return和exit的差别 在linux上分别跑一下这个代码 int main() { return 0; //exit(0 ...

  9. npm 淘宝设置代理

    直接安装cnpm导致无限索引,因此直接使用代理 方法一: 直接在当前用户文件夹下,npmrc 文件上直接设置代理:registry=https://registry.npm.taobao.org 方法 ...

  10. NTAG 标签

    NTAG 标签 这里描述针对 NTAG213.而 NTAG215/216只是容量不同,其它功能都一样.  UID UID 有 7 bytes.上图中有 9 bytes 的 serial number ...