一键安装thrift-0.9.0的脚本
#!/bin/sh
# 一键安装thrift-0.9.0的脚本
# thrift依赖boost、openssl和libevent
# 下面的变量值可以根据实现做修改
boost=boost_1_52_0
openssl=openssl-1.0.1c
libevent=libevent-2.0.19-stable
thrift=thrift-0.9.0
#
# 安装boost
#
printf "\n\033[0;32;34minstalling boost\033[m\n"
tar xzf $boost.tar.gz
cd $boost
./bootstrap.sh
if test $? -ne 0; then
exit 1
fi
./b2 install --prefix=$THIRD_PARTY_HOME/boost
printf "\n\033[0;32;34m./b2 install return $?\033[m\n"
cd -
#
# 安装openssl
#
printf "\n\033[0;32;34minstalling openssl\033[m\n"
tar xzf $openssl.tar.gz
cd $openssl
./config --prefix=$THIRD_PARTY_HOME/openssl shared threads
if test $? -ne 0; then
exit 1
fi
make
if test $? -ne 0; then
exit 1
fi
make install
cd -
#
# 安装libevent
#
printf "\n\033[0;32;34minstalling libevent\033[m\n"
tar xzf $libevent.tar.gz
cd $libevent
./configure --prefix=$THIRD_PARTY_HOME/libevent
if test $? -ne 0; then
exit 1
fi
make
if test $? -ne 0; then
exit 1
fi
make install
cd -
#
# 安装thrift
#
printf "\n\033[0;32;34minstalling thrift\033[m\n"
tar xzf $thrift.tar.gz
cd $thrift
# 按照常规的configure,使用--with-openssl,会遇到
# “Error: libcrypto required.”错误,这里使用CPPFLAGS和LDFLAGS替代
./configure --prefix=$THIRD_PARTY_HOME/thrift \
--with-boost=$THIRD_PARTY_HOME/boost \
--with-libevent=$THIRD_PARTY_HOME/libevent \
CPPFLAGS="-I$THIRD_PARTY_HOME/openssl/include" \
LDFLAGS="-ldl -L$THIRD_PARTY_HOME/openssl/lib" \
--with-qt4=no --with-c_glib=no --with-csharp=no \
--with-java=no --with-erlang=no --with-python=no \
--with-perl=no --with-ruby=no --with-haskell=no \
--with-go=no --with-d=no
if test $? -ne 0; then
exit 1
fi
# 完成上述修改后,configure可以成功了,但还需要下面修改,
# 否则make时会报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
make
if test $? -ne 0; then
exit 1
fi
make install
cd -
# 安装成功提示一下
printf "\n\033[0;32;34minstall SUCCESS\033[m\n"
# 一键安装thrift-0.9.0的脚本
# thrift依赖boost、openssl和libevent
# 下面的变量值可以根据实现做修改
PROJECT_HOME=$HOME/iflow # 项目源码主目录
# thrift及依赖的第三方库源码包存放目录和安装目录,
# 一键脚本要和第三方库源码包放在同一个目录下
boost=boost_1_52_0
openssl=openssl-1.0.1c
libevent=libevent-2.0.19-stable
thrift=thrift-0.9.0
#
# 安装boost
#
printf "\n\033[0;32;34minstalling boost\033[m\n"
tar xzf $boost.tar.gz
cd $boost
./bootstrap.sh
if test $? -ne 0; then
exit 1
fi
./b2 install --prefix=$THIRD_PARTY_HOME/boost
printf "\n\033[0;32;34m./b2 install return $?\033[m\n"
cd -
#
# 安装openssl
#
printf "\n\033[0;32;34minstalling openssl\033[m\n"
tar xzf $openssl.tar.gz
cd $openssl
./config --prefix=$THIRD_PARTY_HOME/openssl shared threads
if test $? -ne 0; then
exit 1
fi
make
if test $? -ne 0; then
exit 1
fi
make install
cd -
#
# 安装libevent
#
printf "\n\033[0;32;34minstalling libevent\033[m\n"
tar xzf $libevent.tar.gz
cd $libevent
./configure --prefix=$THIRD_PARTY_HOME/libevent
if test $? -ne 0; then
exit 1
fi
make
if test $? -ne 0; then
exit 1
fi
make install
cd -
#
# 安装thrift
#
printf "\n\033[0;32;34minstalling thrift\033[m\n"
tar xzf $thrift.tar.gz
cd $thrift
# 按照常规的configure,使用--with-openssl,会遇到
# “Error: libcrypto required.”错误,这里使用CPPFLAGS和LDFLAGS替代
./configure --prefix=$THIRD_PARTY_HOME/thrift \
--with-boost=$THIRD_PARTY_HOME/boost \
--with-libevent=$THIRD_PARTY_HOME/libevent \
CPPFLAGS="-I$THIRD_PARTY_HOME/openssl/include" \
LDFLAGS="-ldl -L$THIRD_PARTY_HOME/openssl/lib" \
--with-qt4=no --with-c_glib=no --with-csharp=no \
--with-java=no --with-erlang=no --with-python=no \
--with-perl=no --with-ruby=no --with-haskell=no \
--with-go=no --with-d=no
if test $? -ne 0; then
exit 1
fi
# 完成上述修改后,configure可以成功了,但还需要下面修改,
# 否则make时会报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
make
if test $? -ne 0; then
exit 1
fi
make install
cd -
# 安装成功提示一下
printf "\n\033[0;32;34minstall SUCCESS\033[m\n"
分类:
C/C++
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义