I'm getting an error when I try to install Caffe on Linux Ubuntu 64. The error is as follows:
/usr/bin/ld: /usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libgflags.a: error adding symbols: Bad value
I tried recompile the gflags library with -fPIC
, but the error changed to as follow:
src/caffe/common.cpp: In function ‘void caffe::GlobalInit(int*, char***)’:
src/caffe/common.cpp:35:5: error: ‘::gflags’ has not been declared
::gflags::ParseCommandLineFlags(pargc, pargv, true);
I also tried to change the CMakeCache.txt of caffe to set the -fPIC
, but do not work either.
This error arrises because gflags 2.1 changed the name of the namespace from
google
togflags
. There are attempts by members of the caffe community to fix this error albeit they are not finalized. You should reassign the namespace from google to gflags as follows.In files
Comment out the
ifndef
This should work temporarily. You should fork and occasionally sync your caffe repo with the BVLC/caffe repo on github so that you get the latest updates of the code.