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
命令時,才編譯通過,在此感謝一下。