1,从官网下载glog 

https://github.com/google/glog

2,解压

unzip glog-master.zip

3,编译环境配置(请务必按照如下命令执行,否则会碰到附录描述的编译错误,折腾了我一个上午的时间)

yum install autoconf automake libtool

4,编译&安装

cd glog-master

./autogen.sh 

./configure 

make -j 24 

make install

5,此时在/usr/local/lib目录下会找到安装成功的glog库文件,在/usr/local/include目录下会找到glog头文件。

 

附录

如果没执行第3步(yum install autoconf automake libtool)命令,直接执行第4步(./autogen.sh)时,会碰到如下错误

Makefile.am:51: error: Libtool library used but 'LIBTOOL' is undefined
Makefile.am:51:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
Makefile.am:51:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
Makefile.am:51:   If 'LT_INIT' is in 'configure.ac', make sure
Makefile.am:51:   its definition is in aclocal's search path.
Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'

然后网上搜索解决办法,很多都提到了要安装libtool,接着安装

yum install libtool

之后再次(./autogen.sh),然并卵,还是没用。

还有aclocal,依然不行。

直到偶然在这篇博客https://blog.csdn.net/weixin_42309501/article/details/80592253中看到

sudo apt-get install autoconf automake libtool

命令时,才编译通过,在此感谢一下。

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐