问题

在安装glog时可能会报错undefined reference to 'FlagRegisterer::FlagRegisterer',原因及方案

1
2
3
GLog needs GFlags compiled in the "google" namespace instead of the now default "gflags" namespace.

In order to set this namespace you must compile and install gflags from source and set the GFLAGS_NAMESPACE variable to "google".

安装

安装gflags

1
2
3
4
5
git clone https://github.com/google/gflags.git
cd gflags && git checkout tags/v2.2.1
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DGFLAGS_NAMESPACE=google .
make
make install

安装glog

1
2
3
git clone https://github.com/google/glog.git
cd glog && git checkout tags/v0.3.5
./autogen.sh && ./configure && make && make install

参考