天天看點

安裝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”

經過上述操作後,編譯時還會遇到::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

注意

#include

隻需要其中一個操作即可