按照 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. Spring IOC知识java反射

    [1] Java反射知识-->Spring IoC :http://www.iteye.com/topic/1123081 [2] Java动态代理-->Spring AOP :http: ...

  2. [转]Go的50坑:新Golang开发者要注意的陷阱、技巧和常见错误-高级

    from : https://levy.at/blog/11 进阶篇 关闭HTTP的响应 level: intermediate 当你使用标准http库发起请求时,你得到一个http的响应变量.如果你 ...

  3. iOS -- xxxViewController进行pop时直接crash进main.m,EXC_BAD_ACCESS(code=1,address=0x20)

    今天在调试程序时,遇到了奇怪的错误.我从主页跳进(push)一个ViewController时一切正常,但是返回主页(pop)时却crash了,直接跳进了main.m(EXC_BAD_ACCESS(c ...

  4. Git安装及SSH Key管理之Windows篇

    一.安装环境 1.本机系统:Windows 10 Pro(64位)2.Git版本:Git-2.11.0-64-bit.exe(64位) 二.Git安装 去官网下载完后一路下一步完成安装,如下图:   ...

  5. js:深入继承

    /**  * js实现继承:  * 1.基于原型链的方式  * 2.基于伪造的方式  * 3.基于组合的方式  */ 一.基于原型链的方式 function Parent(){   this.pv = ...

  6. pycharm pull到github

    1.setting中找到github 正确输入邮箱密码,勾上ssh 2.在本机中git bash 得到ssh代码 输入到github 个人setting中 3.在pycharm中setting项git ...

  7. redis 在我做的容器中的配置路劲

    配置 /etc/redis/redis.conf 数据库位置 /var/lib/redis/dump.rdb

  8. 如何去掉Google搜索的跳转 让你的Google搜索不被reset掉

    http://www.nowamagic.net/librarys/veda/detail/389 在点击google搜索结果时,google会在结果的URL前做个跳转,且有时这个跳转地址会被墙,这样 ...

  9. C++入门一

    C++ 项目结构 Resource Files: 项目引用的位图文件,图标,窗口,光标等.比如,你的程序要生成一个exe文件,而文件的图标是你自定义的图标,那就要在这个工程里面添加Icon资源,添加一 ...

  10. web前端面试系列 - js中的prototype

    js中一切皆为对象,其中函数也是一种对象, 而每个函数都有一个prototype属性,其值也是一个对象. 一.prototype的作用 1. 在多个实例对象之间共享数据和方法. 2. 通过原型链实现继 ...