因为工作需要在linux上安装Thrift,在官网http://thrift.apache.org/developers上查到了如下依赖:
Basic requirements A relatively POSIX-compliant *NIX system Cygwin or MinGW can be used on Windows (but there are better options, see below) g++ 4.2 (4.8 or later required for thrift compiler plug-in support) boost 1.53.0 Runtime libraries for lex and yacc might be needed for the compiler. Requirements for building from source GNU build tools: autoconf 2.65 automake 1.13 libtool 1.5.24 pkg-config autoconf macros (pkg.m4) lex and yacc (developed primarily with flex and bison) libssl-dev
查看当前boost版本:
$ grep BOOST_LIB_VERSION /usr/include/boost/version.hpp // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION #define BOOST_LIB_VERSION "1_41"
下载gcc-7.3.0.tar.gz (http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-7.3.0/)
使用WinSCP从Windows上传到Linux后解压:tar -xvf gcc-7.3.0.tar.gz
查看gcc-7.3.0/contrib/download_prerequisites文件可以看到gcc7.3.0的依赖如下:
gmp='gmp-6.1.0.tar.bz2' mpfr='mpfr-3.1.4.tar.bz2' mpc='mpc-1.0.3.tar.gz' isl='isl-0.16.1.tar.bz2'
gmp官网https://gmplib.org/#DOWNLOAD好像只提供最新版的gmp下载,只好下载了此时最新版gmp-6.1.2.tar.bz2,希望能够和6.1.0一样与GCC7.3.0工作。将下载到了gmp上传到linux,然后解压:tar -xjf gmp-6.1.2.tar.bz2, 然后运行如下命令安装。注意因为这里用的是非root账户,故指定prefix要安装在自己目录下。
./configure --prefix=/home/wqf/usr/lib/gmp-6.1.2/ && make && make install
安装结果如下:
---------------------------------------------------------------------- Libraries have been installed in: /home/wqf/usr/lib/gmp-6.1.2/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the '-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the 'LD_RUN_PATH' environment variable during linking - use the '-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to '/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ----------------------------------------------------------------------
MPFR官网https://www.mpfr.org/mpfr-3.1.4/ 下载mpfr-3.1.4.tar.bz2,从windows上传到linux后解压:tar -xjf mpfr-3.1.4.tar.bz2,然后运行下面命令安装:
./configure --prefix=/home/wqf/usr/lib/mpfr_3.1.4/ --with-gmp=/home/wqf/usr/lib/gmp-6.1.2/ && make && make install