Thrift编译错误('::malloc' has not been declared)
2015-08-21 18:59
633 查看
问题版本:0.9.0
make[4]: Entering directory `/tmp/X/thrift-0.9.0/lib/cpp'
/bin/sh ../../libtool --tag=CXX --mode=compile g++ -DH***E_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++ -DH***E_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命令查找。
make[4]: Entering directory `/tmp/X/thrift-0.9.0/lib/cpp'
/bin/sh ../../libtool --tag=CXX --mode=compile g++ -DH***E_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++ -DH***E_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命令查找。
相关文章推荐
- day8: 属性、点语法、KVC
- Memcache缓存 vs 直接File文件缓存
- 用EF实现多条件查询
- super关键字详解
- android 组件ProgressBar实例
- SPOJ 题目705 New Distinct Substrings(后缀数组,求不同的子串个数)
- Codeforces Gym 100338B Geometry Problem 计算几何
- C++——string类和标准模板库
- ckeditor若文件上传的不是图片类型则显示不成功
- VS报错:Oracle.ManagedDataAccess.Client.OracleException: ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值
- 微信公众平台开发(2)回复超链接
- hdoj-1869 六度分离【最短路径--dijkstra&&spfa&&floyd】
- 在N个乱序数字中查找第k大的数字
- 微信公众平台开发(2)回复超链接
- 深入分析C++中deque的使用
- 《Java设计模式》之访问者模式
- Canvas旋转图片--保持相同大小的算法
- 浮点数二分答案 HDU1969
- JAVA生成Word文档(经过测试)
- JAVA用freemarker生成复杂Excel。(freemarker)