编译Thrift

Posted longbigfish

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编译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的主要内容,如果未能解决你的问题,请参考以下文章

thrift入门

Thrift第三课 编写脚本

SpringBoot整合RPC框架---Thrift

[Linux]以匹配系统为例入门Thrift框架

Thrift介绍以及Java中使用Thrift实现RPC示例

编译器如何编译编译器?