博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Thrift编译错误('::malloc' has not been declared)
阅读量:7099 次
发布时间:2019-06-28

本文共 2037 字,大约阅读时间需要 6 分钟。

问题版本:0.9.0
make[4]: Entering directory `/tmp/X/thrift-0.9.0/lib/cpp'
/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/usr/local/thirdparty/boost/include -I./src -I./src/thrift -I/usr/local/thirdparty/openssl/include -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/thrift/Thrift.cpp' || echo './'`src/thrift/Thrift.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/thirdparty/boost/include -I./src -I./src/thrift -I/usr/local/thirdparty/openssl/include -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/thrift/Thrift.cpp  -fPIC -DPIC -o .libs/Thrift.o
In file included from src/thrift/Thrift.cpp:22:
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/
cstdlib:119: error:
'::malloc' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cstdlib:127: error: '::realloc' has not been declared
src/thrift/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)':
src/thrift/Thrift.cpp:46: error: 'malloc' was not declared in this scope
make[4]: *** [Thrift.lo] Error 1
解决方法:
在成功执行configure后(在未执行configure之前找不到下列两行),修改与configure同目录下的config.h文件,将文件中的如下两行注释掉:
#define malloc rpl_malloc
#define realloc rpl_realloc
附1:安装Thrift命令行:
./configure --prefix=/usr/local/thirdparty/thrift-0.9.0 --with-boost=/usr/local/thirdparty/boost --with-libevent=/usr/local/thirdparty/libevent CPPFLAGS="-I/usr/local/thirdparty/openssl/include" LDFLAGS="-ldl -L/usr/local/thirdparty/openssl/lib" --with-qt4=no --with-c_glib=no --with-csharp=no --with-erlang=no --with-perl=no --with-ruby=no --with-haskell=no --with-go=no --with-d
当OpenSSL未以默认安装目录时,请注意上面的用法。
附2:相关博文:
(安装thrift时,注意openssl参数)http://blog.chinaunix.net/uid-20682147-id-3399150.html
如果在使用Thrift时,编译遇到类似“TTransport.h:107: error: 'uint32_t' does not name a type”的错误,只需要在Thrift.h文件中增加一行:#include <stdint.h>。
Thrift.h文件位于make install后的include目录下,如果不知道在哪,可以使用find命令查找。

转载于:https://www.cnblogs.com/aquester/p/9891585.html

你可能感兴趣的文章
js:字符串的一些操作方法?
查看>>
从零开始实现一个MQTT客户端 开篇漫谈
查看>>
谈一谈Flutter中的共享元素动画Hero
查看>>
vue在低版本的iOS下出现白屏现象解决方案
查看>>
vim从入门到弃坑:基础指令的归类
查看>>
[译] 苹果公司如何修复 3D Touch
查看>>
Linux下Git服务器架设
查看>>
如烟花般绚丽的区块链平台,剥下代币狼皮后如何生存?
查看>>
App爬虫神器mitmproxy和mitmdump的使用
查看>>
再说swift namespace
查看>>
初学 Android 架构组件之 ViewModel
查看>>
iOS AOP 框架 - Aspects 源码解读
查看>>
获取iOS客户端屏幕最上面的视图控制器
查看>>
iOS RunLoop分析
查看>>
canvas系列教程08-canvas各种坑
查看>>
单线程的js是如何工作的
查看>>
localStorage
查看>>
循环中的异步&&循环中的闭包
查看>>
外墙清洗机器人现身多幢大楼,清洗前后泾渭分明!
查看>>
算法与数据结构之枚举算法
查看>>