编译Thrift
按照 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的更多相关文章
- 编译Thrift支持golang
本文已经是很久以前的文章了,也不知道新版本thrift如何 Thrift是一个跨语言的服务部署框架,Thrift通过一个中间语言(IDL, 接口定义语言)来定义RPC的接口和数据类型,然后通过一个编译 ...
- 记录Mac OS下编译Thrift库
方法一:brew管理工具安装Homebrew是Mac开发包管理工具,类似于Linux的apt-get之类的,实它相当于开发软件界的 Appstore.借助该管理工具,可以自动化地安装软件包,它会自动安 ...
- 编译thrift外篇-关于默认链接包-(使用mapkeeper运行leveldb成功)
根据 https://stackoverflow.com/questions/9922949/how-to-print-the-ldlinker-search-path 使用 ldconfig -v ...
- thrift 服务端linux C ++ 与客户端 windows python 环境配置(thrift 自带tutorial为例)
关于Thrift文档化的确是做的不好.摸索了很久才终于把跨linux与windows跨C++与python语言的配置成功完成.以下是步骤: 1) Linux下环境配置 ...
- thrift笔记
Thrift tutorial 演示 python服务端与客户端本文的开发环境是windows 7 + python2.7.3Thrift官方主页:http://thrift.apache.org/先 ...
- Thrift 的原理和使用
thrift 的原理和使用 Thrift 架构 Thrift是一个跨语言的服务部署框架,最初由Facebook于2007年开发,2008年进入Apache开源项目.Thrift通过IDL(Interf ...
- Thrift 个人实战--Thrift 的序列化机制
前言: Thrift作为Facebook开源的RPC框架, 通过IDL中间语言, 并借助代码生成引擎生成各种主流语言的rpc框架服务端/客户端代码. 不过Thrift的实现, 简单使用离实际生产环境还 ...
- Thrift在Windows及Linux平台下的安装和使用示例
本文章也同时发表在个人博客Thrift在Windows及Linux平台下的安装和使用示例上. thrift介绍 Apache Thrift 是 Facebook 实现的一种高效的.支持多种编程语言的R ...
- Win7+VS2013初试Thrift
win7环境下VS2013编译boost_1_58_0步骤: 官网下载boost_1_58_0(直接下载),解压 cmd窗口cd到boost_1_58_0,执行bootstrap.bat cmd窗口获 ...
随机推荐
- linux 用户管理命令学习
groupadd www-data 添加组 useradd phpcomposer -g www-data 添加用户并加入组中 passwd phpcomposer 添加密码 usermod -g p ...
- html中的列表标签
1.<dl>定义列表,<dt>定义列表中的项目,<dd>对项目的描述 例: 效果: 2.<ul>无序列表,<li>列表项 例: 效果: 3. ...
- [Android] 环境配置之Android Studio开发NDK
分类:Android环境搭建 (14351) (20) ========================================================作者:qiujuer博客:bl ...
- 转: 写给想成为前端工程师的同学们 (from 360前端团队)
转自: http://www.75team.com/post/to-be-a-good-frontend-engineer.html 前端工程师是做什么的? 前端工程师是互联网时代软件产品研发 ...
- margin: 0 auto; 元素水平居中布局无效
失效原因: 要给居中的元素一个宽度,否则无效. 该元素一定不能浮动或绝对定位,否则无效. 在HTML中使用<center></center>标签,需考虑好整体构架,否者全部元素 ...
- Cts框架解析(15)-任务运行完
case运行完成后.会回到CtsTest的run方法中: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaXRmb290YmFsbA==/font/5a6L ...
- UiAutomator源代码分析之获取控件信息
依据上一篇文章<UiAutomator源代码分析之注入事件>開始时提到的计划,这一篇文章我们要分析的是第二点: 怎样获取控件信息 我们在測试脚本中初始化一个UiObject的时候一般是像下 ...
- 小printf的故事:什么是真正的程序员?
http://kb.cnblogs.com/page/570194/ 作者: 削微寒 来源: 博客园 发布时间: 2017-06-06 10:03 阅读: 33004 次 推荐: 98 原 ...
- 实记处理mongodb的NUMA问题
一次在启动mongodb的过程中,出现过NUMA这个问题, mongodb日志显示如下: WARNING: You are running on a NUMA machine. We suggest ...
- html中设置透明遮罩层的兼容性代码
说明:下面遮罩层的height视实际情况自行修改,要求显示的div层的样式需加上position:relative,位于遮罩层层div的下面一行.<div id="ceng" ...