Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Thrift编译错误('::malloc' has not been declared)

Thrift编译错误('::malloc' has not been declared)

作者头像
一见
发布于 2018-08-06 11:23:04
发布于 2018-08-06 11:23:04
1.8K0
举报
文章被收录于专栏:蓝天蓝天

问题版本:0.9.0

make4: 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

make4: *** 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参数)https://cloud.tencent.com/developer/article/1179707

如果在使用Thrift时,编译遇到类似“TTransport.h:107: error: 'uint32_t' does not name a type”的错误,只需要在Thrift.h文件中增加一行:#include 。

Thrift.h文件位于make install后的include目录下,如果不知道在哪,可以使用find命令查找。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2015/08/21 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
大数据应用日志采集之Scribe 安装配置指南
Scribe是Facebook开源的日志收集系统,在Facebook内部已经得到大量的应用。它能从各种日志源收集日志,存储到一个中央存储系统上,便于进行集中统计分析处理。它为日志的”分布式收集,统一处理”提供了一个可扩展的,高容错的方案。scribe代码很简单,但是安装配置却很复杂,本文记录了作者实际的一次安装的过程,感觉真是不一般的琐碎,另外Scribe开源社区的版本已经是几年前的版本了,最新的维护信息一致没有看到,HDFS和Thrift的版本使用的都是比较旧的版本,考虑另开一个分支,升级一下Scribe,看到时候有没有时间了。
数据饕餮
2019/01/14
8210
minigui:mgplus交叉编译警告 include locationi
版权声明:本文为博主原创文章,转载请注明源地址。 https://blog.csdn.net/10km/article/details/83088803
10km
2019/05/25
9460
Mac 安装 Swoole 出现 Enable openssl support, require openssl library 的解决办法
今天升级 Swoole 版本的时候,指定开启 OpenSSL 的时候报错了。以下是场景还原
hedeqiang
2019/12/18
2.5K0
Mac 安装 Swoole 出现 Enable openssl support, require openssl library 的解决办法
CentOS上安装Web性能测试工具Siege & 示例
可以访问【http://download.joedog.org/siege/】下载Siege安装包,本文下载的是siege-4.0.2.tar.gz
孟君
2020/04/23
2.7K0
CentOS上安装Web性能测试工具Siege & 示例
使用thrift大量编译警告消息方法
https://issues.apache.org/jira/browse/THRIFT-1824
一见
2018/08/07
7290
php编译pdo_mysql扩展记录
这次作死,直接用默认配置安装了php。什么扩展都没有添加。结果一直在编译缺失的各种扩展。但是最后还是失败了,仅用做记录用。
魔王卷子
2019/06/02
4.3K2
Android集成lrzsz[通俗易懂]
本文中的lrzsz代码点击此处获取 Hikey开发板有两类USB口,两组USB-TypeA母口作为Host,可以接键盘、鼠标。另一组mini-USB母口,作为devices,可以接到电脑上调试。但目前这两种接口无法同时使用,即通过键盘鼠标操作时不能使用ADB。 虽然可以通过minicom或者putty之类的工具连接串口查看LOG、执行命令。但Android系统中缺少通过串口传输文件的工具,有文件传输需求的时候还需要插上ADB口,通过adb push/pull操作,不是太方便。
全栈程序员站长
2022/09/09
2.8K0
Android集成lrzsz[通俗易懂]
如何使用C++通过thrift访问HBase进行操作
上周六,接了一个紧急任务,说实现使用 C++ 访问 HBase 进行操作。说是用 thrift 来实现。对于 C++ 来说,我真的是门外汉,但需求如此,皱着眉头也要把它实现。好歹在同事的帮助下,也是实现了 demo 示例,现在就把这两天的成果分享给大家。
create17
2019/05/14
3.5K0
如何使用C++通过thrift访问HBase进行操作
Snort 基础6
然后编译和安装 [root@h101 daq-2.0.6]# make make all-recursive make[1]: Entering directory `/tmp/snort/daq-2.0.6' Making all in api make[2]: Entering directory `/tmp/snort/daq-2.0.6/api' /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I..
franket
2022/05/03
2900
C/C++常见gcc编译链接错误解决方法
用“-Wl,-Bstatic”指定链接静态库,使用“-Wl,-Bdynamic”指定链接共享库,使用示例: -Wl,-Bstatic -lmysqlclient_r -lssl -lcrypto -Wl,-Bdynamic -lrt -Wl,-Bdynamic -pthread -Wl,-Bstatic -lgtest ("-Wl"表示是传递给链接器ld的参数,而不是编译器gcc/g++的参数。) 1) 下面是因为没有指定链接参数-lz(/usr/lib/libz.so,/usr/lib/libz.a ) /usr/local/mysql/lib/mysql/libmysqlclient.a(my_compress.c.o): In function `my_uncompress': /home/software/mysql-5.5.24/mysys/my_compress.c:122: undefined reference to `uncompress' /usr/local/mysql/lib/mysql/libmysqlclient.a(my_compress.c.o): In function `my_compress_alloc': /home/software/mysql-5.5.24/mysys/my_compress.c:71: undefined reference to `compress' 2) 下面是因为没有指定编译链接参数-pthread(注意不仅仅是-lpthraed) /usr/local/mysql/lib/mysql/libmysqlclient.a(charset.c.o): In function `get_charset_name': /home/zhangsan/mysql-5.5.24/mysys/charset.c:533: undefined reference to `pthread_once' 3) 下面这个是因为没有指定链接参数-lrt /usr/local/thirdparty/curl/lib/libcurl.a(libcurl_la-timeval.o): In function `curlx_tvnow': timeval.c:(.text+0xe9): undefined reference to `clock_gettime' 4) 下面这个是因为没有指定链接参数-ldl /usr/local/thirdparty/openssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup': dso_dlfcn.c:(.text+0x4c): undefined reference to `dlopen' dso_dlfcn.c:(.text+0x62): undefined reference to `dlsym' dso_dlfcn.c:(.text+0x6c): undefined reference to `dlclose' 5) 下面这个是因为指定了链接参数-static,它的存在,要求链接的必须是静态库,而不能是共享库 ld: attempted static link of dynamic object 如果是以-L加-l方式指定,则目录下必须有.a文件存在,否则会报-l的库文件找不到:ld: cannot find -lACE 6) GCC编译遇到如下的错误,可能是因为在编译时没有指定-fPIC,记住:-fPIC即是编译参数,也是链接参数 relocation R_x86_64_32S against `vtable for CMyClass` can not be used when making a shared object 7) 下面的错误表示gcc编译时需要定义宏__STDC_FORMAT_MACROS,并且必须包含头文件inttypes.h test.cpp:35: error: expected `)' before 'PRIu64' 8) 下面是因为在x86机器(32位)上编译没有指定编译参数-march=pentium4 ../../src/common/libmooon.a(logger.o): In function `atomic_dec_and_test': ../../include/mooon/sys/atomic_gcc.h:103: undefined reference to `__sync_sub_and_fetch_4' 9) 下列错误可能是因为多了个“}” error: expected d
一见
2018/08/10
8.1K0
error: include location "/usr/include/" is unsafe for cross-compilation
如果不做交叉编译,host指定为当前机器的架构(x86_64-linux-gnu)则编译正常 如果设置为mips-linux-gnu进行交叉编译,就报错了:
10km
2019/05/26
3.5K0
安装thrift时,注意openssl参数
在安装基于openssl-1.0.1c的thrift-0.9.0时,正常使用--with-openssl在configure时会出错,报“Error: libcrypto required.”错误,为解决这个错误,可以使用CPPFLAGS="-I$HOME/iflow/openssl/include" LDFLAGS="-ldl -L$HOME/iflow/openssl/lib"替代“--with-openssl”
一见
2018/08/07
2.1K0
memcached基础4
checking build system type... x86_64-unknown-linux-gnu
franket
2022/06/26
3370
学习笔记0507----LAMP架构
LAMP:Linux+Apache(httpd)+Maridb(Mysql)+PHP,常用来搭建动态网站或者服务器的开源软件。
嘻哈记
2020/11/24
2K0
Thrift编译错误解决方法
下面这个错误可能是因为DOS(Windows)和Unix文件格式问题: checking whether g++ supports C++11 features by default... no checking whether g++ supports C++11 features with -std=c++11... no configure: No compiler with C++11 support was found ./configure: line 16746: syntax error near unexpected token `fi' ./configure: line 16746: `fi' 解决方法是设置好git: [core] autocrlf = false safecrlf = true eol = lf 对应的命令为: git config --global core.autocrlf false git config --global core.safecrlf true git config --global core.eol lf 完成后,删除再重新从git上clone出来。 下面这个错误原因暂不清楚(configure时指定了--with-qt4=no,按理代码应当不会进入才对): checking for ranlib... (cached) ranlib checking whether g++ supports C++11 features by default... no checking whether g++ supports C++11 features with -std=c++11... no configure: No compiler with C++11 support was found ./configure: line 17658: syntax error near unexpected token `QT,' ./configure: line 17658: `    PKG_CHECK_MODULES(QT, QtCore >= 4.3, QtNetwork >= 4.3, have_qt=yes, have_qt=no)' 但可以编辑configure文件,然后将相应的行注释掉,如: #  if test "$with_qt4" = "yes";  then #    PKG_CHECK_MODULES(QT, QtCore >= 4.3, QtNetwork >= 4.3, have_qt=yes, have_qt=no) #  fi 其它类似的错误都可以这样处理。 下面这个错误发生在x86_64上,也根据提示来操作: /usr/local/thirdparty/openssl/include/openssl/sha.h:184: error: ISO C++ does not support 'long long' /usr/local/thirdparty/openssl/include/openssl/sha.h:185: error: ISO C++ does not support 'long long' /usr/local/thirdparty/openssl/include/openssl/sha.h:187: error: ISO C++ does not support 'long long' 修改sha.h的相应代码行,将SHA_LONG64改成int64_t(需要#include )或long即可。
一见
2018/08/10
2.4K0
Linux开发环境第三方库规划
让工作变得有条理,不乱糟糟,即使存在大量的第三方,也有章可循。简而言之,就是要保持目录的干净(如/usr/local目录),保持文件的干净(如profile文件)
一见
2018/08/10
1.4K0
宝塔PHP安装amqp扩展
因业务需要需要使用MQ,需要用到amqp,但现在所使用的PHP环境没有装这个扩展,参考segmentfault里的一篇教程进行安装,整理出了下面的教程。在这里,感谢@一个向往前端的后端工程师
jwj
2022/05/18
2.4K0
学习笔记0512----LAMP架构(三)
防盗链,通俗讲就是不让别人盗用你网站上的资源,这个资源指的是图片、视频、歌曲、文档等,在这之前需要理解一下referer的概念,如果你通过A网站的一个页面http://a.com/a.html里面的链接去访问B网站的一个页面http://b.com/b.html,那么这个B网站页面的referer就是http://a.com/a.html。也就是说,一个referer就是一个网址。
嘻哈记
2020/11/24
8560
SQLite 基础2
解压安装 解压安装命令 使用下列命令进行解压安装 tar -zxvf sqlite-autoconf-3110100.tar.gz cd sqlite-autoconf-3110100 ./configure --prefix=/usr/local/sqlite3.11 make make install 详细安装过程 [root@h102 sqlite]# tar -zxvf sqlite-autoconf-3110100.tar.gz sqlite-autoconf-3110100/ sqlite-
franket
2021/12/01
3960
Snort 基础13
然后编译和安装 [root@h101 snort-2.9.7.6]# make make all-recursive make[1]: Entering directory `/tmp/snort/snort-2.9.7.6' Making all in src make[2]: Entering directory `/tmp/snort/snort-2.9.7.6/src' Making all in sfutil make[3]: Entering directory `/tmp/snort/sn
franket
2022/05/03
3780
相关推荐
大数据应用日志采集之Scribe 安装配置指南
更多 >
交个朋友
加入[跨境业务] 腾讯云官方方案交流站
共享跨境方案指南 洞察行业动向
加入架构与运维学习入门群
系统架构设计入门 运维体系构建指南
加入HAI高性能应用服务器交流群
探索HAI应用新境界 共享实践心得
换一批
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档