问题版本: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命令查找。

Thrift编译错误('::malloc' has not been declared)的更多相关文章

  1. Thrift-0.10.0 CenOS 7 编译错误 error: expected ')' before 'PRIu32'

    Thrift-0.10.0 CenOS 7 编译错误 error: expected ')' before 'PRIu32' 在编译Thrift的时候,无论是Apache官网tar包,还是Github ...

  2. 【Redis】编译错误zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory

    [Redis]编译错误zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory 在安装redis进行编译 ...

  3. I.MX6 linux kernel编译错误处理

    /******************************************************************************** * I.MX6 linux kern ...

  4. thrift编译java的问题-(安装thrift0.8.0成功-编译mapkeeper.java成功)

    上一次帖子说了thrift编译java出现错误,由于只用到cpp版的,就将此略过.但是老版本的ycsb不是很好用,于是决定以locall的方式编译mapkeeper供最新版ycsb使用.目前根据 ht ...

  5. xamarin.forms新建项目android编译错误

    vs2015 update3 新建的xamarin.forms项目中的android项目编译错误.提示缺少android_m2repository_r22.zip,96659D653BDE0FAEDB ...

  6. 《转载》使用org.w3c.dom.Element的setTextContent()、getTextContent()方法时出现编译错误

    今天在更新项目后进行编译时,出现如下错误一堆: 编译错误 Google之,在stackoverflow上看到如下的解决方法: I came here with the same problem. Ev ...

  7. asp.net教程:编译错误同时存在于不同dll中

    asp.net 编译错误类型“同时存在于”不同的dll中. 出现这种错误大概有三种情况: 1.ASPX页面,一个*.ASPX,对应着一个*.cs文件,两者其实是一个文件,通过两者实现代码分离,每个*. ...

  8. VS2010出现FileTracker : error FTK1011编译错误的解决办法

    VS2010出现FileTracker : error FTK1011不知道是不是vs2010的一个bug,反正有人提交了. FileTracker : error FTK1011编译错误的解决办法有 ...

  9. PowerDesginer 生成的Oracle 11g 组合触发器代码编译错误(29): PLS-00103

    问题描述: 采用PowerDesigner15针对Oracle 11g 创建物理数据模型,想实现一个字段的自增,采用如下步骤: 1.创建序列,命名为Sequence_1; 2.在自增字段编辑窗口中,选 ...

随机推荐

  1. bootstrap 在超小屏布局时使用 clearfix

    bootstrap 在超小屏布局时使用 clearfix 先看案例,一共四个 div,使用 col-xs-6, 所以在特别小型设备上时会变成两行. 不过我们发现如果第一个 div 内容多了后会变成如下 ...

  2. DevExpress GridControl 单元格添加进度条(ProgressBar)

    首先可以使用DevExpress GridControl 自带的进度条控件. 但是我要用一个方法来设置所以的单元格进度,而不是每个单元格都要设置一遍,同时我想要根据进度值不同,进度条显示不同的颜色. ...

  3. ProcessHelp 进程类(启动,杀掉,查找)

    using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ...

  4. Ninject Lazy Load问题

    参考: http://stackoverflow.com/questions/2538132/lazy-loading-with-ninject  方案一: public class Module : ...

  5. 八、jdk工具之JvisualVM、JvisualVM之二--Java程序性能分析工具Java VisualVM

    目录 一.jdk工具之jps(JVM Process Status Tools)命令使用 二.jdk命令之javah命令(C Header and Stub File Generator) 三.jdk ...

  6. Java之MD5加密

    一.Message Digest Algorithm MD5(中文名为消息摘要算法第五版)为计算机安全领域广泛使用的一种散列函数,用以提供消息的完整性保护.该算法的文件号为RFC 1321(R.Riv ...

  7. js 获取下一秒 时间

    function getNextTime(start){ //var start = '09:30:00'; var _s = new Date(); var startDate = _s.getFu ...

  8. 【好文转帖】控制反转(IOC)和依赖注入(DI)的区别

    IOC   inversion of control  控制反转 DI   Dependency Injection  依赖注入 要理解这两个概念,首先要搞清楚以下几个问题: 参与者都有谁? 依赖:谁 ...

  9. Mock.js开发中拦截Ajax

    Mock.js 是一款前端开发中拦截Ajax请求再生成随机数据响应的工具.可以用来模拟服务器响应. 优点是非常简单方便, 无侵入性, 基本覆盖常用的接口数据类型. 在我们的生产实际中,后端的接口往往是 ...

  10. 搜索框请输入关键字 onfocus 和 onblur

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...