问题版本: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. bzoj1037生日聚会

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1037 任意区间的话,可以从所有后缀区间考虑. 因为每一个区间一定是某一时刻的一个后缀区间,所 ...

  2. NOIP 2005 校门外的树

    #include<iostream> #include<cstring> using namespace std; int a[10005]; int main() { mem ...

  3. 在vc++上简单搭建环境(包括文件引用)

    1,triplet_head.h 文件 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define OVER_FLOW -2 ...

  4. 字符串作为freemarker模板的简单实现例子

    本文转载自:http://blog.csdn.net/5iasp/article/details/27181365 package com.test.demo; import java.io.IOEx ...

  5. 学习blus老师js(2)--深入JavaScript

    1.函数传参 可变参(不定参):arguments 参数的个数可变,参数数组   例1.求和 求所有参数的和 <!DOCTYPE HTML> <html> <head&g ...

  6. [转]Java IDE 之 IntelliJ IDEA 2017

    参考链接1:http://blog.csdn.net/u012364631/article/details/47682011 IDEA Community(社区版) 使用Maven创建Web工程 并部 ...

  7. 如何制作行政区划矢量图(shp格式)

    详细图文ArcGIS10.2破解版教程地址:http://jingyan.baidu.com/article/e73e26c0cb5c1324adb6a791.html 有时候想要一张shp格式的地方 ...

  8. Oracle中 HWM与数据库性能的探讨

    链接:http://www.eygle.com/archives/2011/11/oracle_hwm_tuning.html 本文讨论的是oracle中关于table的HWM的内容,主要包括这样几个 ...

  9. oracle9i-11.2安装包及补丁包下载链接

    ORACLE 9i Oracle9i Database Release 2 Enterprise/Standard/Personal Edition for Windows NT/2000/XPhtt ...

  10. CentOS 环境下基于 Nginx uwsgi 搭建 Django 站点

    因为我的个人网站 restran.net 已经启用,博客园的内容已经不再更新.请访问我的个人网站获取这篇文章的最新内容,CentOS 环境下基于 Nginx uwsgi 搭建 Django 站点 以下 ...