问题版本: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. 5.Appium+真机Demo

    1.连接真机后,执行代码时出现错误:A new session could not be created. (Original error: Could not extract PIDs from p ...

  2. C++ is-a关系

    首先举一个例子: 在日常生活中,我们所说的眼镜大都是带框的眼镜,但是当提起隐形眼镜时,我们想一下它属不属于眼镜呢?答案肯定是属于的.这里的隐形眼镜和眼镜就是属于 is-a 的关系. 在面向对象编程过程 ...

  3. while循环优化版本-for循环

    for i in range(0,10): if i <3: print("loop ",i) else : continue print("hehe...&quo ...

  4. 十四.jQuery解析之浏览器嗅探

    Chrome和Safrai使用的是webkit作为内核引擎,因此如果 jQuery.browser.webkit为true,则表示浏览器是chrome或safari; 如果jQuery.browser ...

  5. 使用Fiddler对Android手机的应用数据进行抓包分析

    文章源自: http://blog.csdn.net/zshq280017423/article/details/8928616/ 对于Android开发的同事最头疼的事情莫过于真机抓包,然后Fidd ...

  6. 前端开发中常用的CSS选择器解析(一)

    你也许已经掌握了id.class.后台选择器这些基本的css选择器.但这远远不是css的全部.下面向大家系统的介绍css中最常用的选择器,包括我们最头痛的浏览器兼容性问题.掌握了它们,才能真正领略cs ...

  7. 对象的notify方法的含义和对象锁释放的三种情况

    1,notify的含义     (1)notify一次只随机通知一个线程进行唤醒 (2)在执行了notify方法之后,当前线程不会马上释放该对象锁,呈wait状态的线程也不能马上获得该对象锁, 要等到 ...

  8. django 下载文件 无法正常打开

    下载文件,无法正常打开,如下图 需手动加后缀名修改文件格式方可正常打开进而能得知文件内容正常如下图,给“下载”文件加上后缀即可得到正常下载的内容 问题整理:(此下载功能采用StreamHttpResp ...

  9. PM2 介绍

    [源引]https://github.com/Unitech/pm2 pm2 是一个带有负载均衡功能的Node应用的进程管理器.当你要把你的独立代码利用全部的服务器上的所有CPU,并保证进程永远都活着 ...

  10. 【bzoj1597】[Usaco2008 Mar]土地购买

    1597: [Usaco2008 Mar]土地购买 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 3739  Solved: 1376[Submit] ...