Hobo Chen

Compile Failed When Install GLog (Google Log)

I want to install Google Log(C++) in my Ubuntu, but I met the problem:
/usr/bin/ld: //usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC.

The cause is that the gflags is not compiled as shared libraries when installing.
Here is a solution.

Jump to gflags directory, and run ccmake .. Change the BUILD_SHARED_LIBS to ON.

If you found that ccmake is not found.

sudo apt install cmake-curses-gui

Then, jump back to glog directory, run:

make -j`nproc` && sudo make install