安装thrift时,注意openssl参数

9079阅读 4评论2012-11-06 Aquester
分类:C/C++

在安装基于openssl-1.0.1c的thrift-0.9.0时,正常使用--with-openssl在configure时会出错,报“Error: libcrypto required.”错误,为解决这个错误,可以使用CPPFLAGS="-I$HOME/iflow/openssl/includeLDFLAGS="-ldl -L$HOME/iflow/openssl/lib"替代“--with-openssl”

经过上述操作后,编译时还会遇到::malloc未声明错误,这个时候需要修改config.h,一是在第一行加入#include ,二是注释掉#define malloc rpl_malloc一行

自动化脚本可以写成如下(前两行经测试可以不用):
sed -i -e 's!#define HAVE_MALLOC 0!#define HAVE_MALLOC 1!' config.h
sed -i -e 's!#define HAVE_REALLOC 0!#define HAVE_REALLOC 1!' config.h
sed -i -e 's!#define malloc rpl_malloc!/*#define malloc rpl_malloc*/!' config.h
sed -i -e 's!#define realloc rpl_realloc!/*#define realloc rpl_realloc*/!' config.h

注意
sed -i -e 's!#define HAVE_MALLOC 0!#define HAVE_MALLOC 1!' config.h
sed -i -e 's!#define HAVE_REALLOC 0!#define HAVE_REALLOC 1!' config.h
#include
只需要其中一个操作即可
上一篇:优秀开源组合:助你快速研发
下一篇:thrift使用小记

文章评论