编译安装glog出现以下错误
[ 36%] Linking CXX shared library libglog.so
/usr/bin/ld: /usr/local/lib/libgflags_nothreads.a(gflags.cc.o): relocation R_X86_64_PC32 against symbol `_ZN22gflags_mutex_namespace5MutexD1Ev' can not be used when making a shared object; recompile with -fPIC
为排除此问题,从依赖开始安装glog
glog install guide
step1 安装gflags
cd "你想编译gflags的路径"
git clone https://github.com/gflags/gflags.git
此时打开/gflags/CMakeLists.txt
添加
add_compile_options(-fPIC)
如图所示:
继续编译按照gflags
cd gflags
mkdir build
cd build
cmake ..
make
sudo make install
step2 安装glog
cd "你想编译glog的路径"
git clone https://github.com/google/glog.git
cd glog
mkdir build
cd build
cmake ..
make
sudo make install
版权声明:本文为dbqbad原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。