Linux非管理员用户安装gflags库和glog库

1.安装必备工具m4, autoconf, automake, libtool
安装m4

 cd temp
 wget http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz
 tar zxvf m4-1.4.18.tar.gz
 cd m4-1.4.18
 ./configure --prefix=/your_root_path/local
 make
 make install

安装autoconf

 cd temp
 wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
 tar zxvf autoconf-2.69.tar.gz
 cd autoconf-2.69
 ./configure --prefix=/your_root_path/local
 make
 make install

安装automake

 cd temp
 wget http://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz
 tar zxvf automake-1.16.1.tar.gz
 cd automake-1.16.1
 ./configure --prefix=/your_root_path/local
 make
 make install

安装libtool

 cd temp
 wget http://mirror.csclub.uwaterloo.ca/gnu/libtool/libtool-2.4.6.tar.gz
 cd libtool-2.4.6
 tar zxvf libtool-2.4.6.tar.gz
 ./configure --prefix=/your_root_path/local
 make
 make install

将它们的可执行程序路径写入环境变量中:

vim ~/.bashrc

点击i进入输入模式
将下列代码复制粘贴到文件最后:

export PATH="/your_root_path/local/bin:$PATH"
export LIBRARY_PATH="/your_root_path/local/lib:$LIBRARY_PATH"
export LD_LIBRARY_PATH="/your_root_path/local/lib:$LD_LIBRARY_PATH"

点ESC退出输入模式,输入:wq进行保存并退出。
命令行输入source ~/.bashrc激活环境变量。
可分别使用下面的命令进行版本查询并验证是否安装成功:

m4 --version
autoconf --version
automake --version
libtool --version

2.安装boost库
源码下载地址:https://www.boost.org/users/history/version_1_67_0.html
或使用wget下载。

cd temp
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
tar zxvf boost_1_67_0.tar.gz
cd boost_1_67_0
./bootstrap.sh --prefix=/your_root_path/local
./b2 -j32
./b2 install

将boost库头文件路径写入环境变量:

vim ~/.bashrc

插入以下代码

export BOOST_INCLUDEDIR="/your_root_path/local/include:$BOOST_INCLUDEDIR"

点ESC退出输入模式,输入:wq进行保存并退出。
命令行输入source ~/.bashrc激活环境变量。
3.安装Glog

git clone https://github.com/google/glog.git
cd glog
./autogen.sh
./configure --prefix=/your_root_path/local
 make
 make install

ps1:可能会遇到bug: 执行bash./ autogen时报错“没有这个文件”
解决:https://blog.csdn.net/qq_42921511/article/details/120604942
ps2:./configure --prefix=/your_root_path/local 中your_root_path要修改为自己的路径。

4.安装Gflags

git clone https://github.com/gflags/gflags
cd gflags
mkdir build
cd build
CXXFLAGS="-fPIC" cmake -D CMAKE_INSTALL_PREFIX=/your_root_path/local ..
make -j4 
make install

ps:第五行代码中your_root_path要修改为自己的路径。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值