Reputation: 183
I'm trying to install Caffe on Debian, but when i do make all
i get this error:
/usr/bin/ld: /usr/local/lib/libglog.a(logging.cc.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libglog.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status make: *** [.build_release/lib/libcaffe.so] Error 1
where should i add the -fPIC
flag?
I also read that it wasn't enough for gflags
.
Any suggestions?
Upvotes: 3
Views: 1143
Reputation: 8754
In glog, adding -fPIC
to AM_CXXFLAGS
in Makefile.am
works. Adding it to the CXXFLAGS
environment variable had no effect for me.
Upvotes: 0
Reputation: 5512
Seems like the only solution in to recompile the problematic 3rd parties with -fPIC. (Unless you can link to the .so instead of the .a)
The standard build of static libraries in packages is to build without -fPIC.
In glog, for example, you should add it to the C flags in compile.ac.
Upvotes: 0