imzhenyu/rDSN

protobuf is ok?

zdy0009 opened this issue · 1 comments

I use counter.proto to create some files ,when I compile ,error happened :Linking CXX shared library lib/libcounter.so
/usr/bin/ld: /home/zdy/rdsninstall/lib/libprotobuf.a(arena.cc.o): relocation R_X86_64_32 against `_ZN6google8protobuf5Arena23lifecycle_id_generator_E' can not be used when making a shared object; recompile with -fPIC
/home/zdy/rdsninstall/lib/libprotobuf.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libcounter.so] Error 1
make[1]: *** [CMakeFiles/counter.dir/all] Error 2
make: *** [all] Error 2
ERROR: build failed

Is that protobuf not ok?

@zdy0009 , sorry for late response.

By default, protobuf is compiled as a static library without the compiler argument "-fPIC" (position-independent code). Please open the file "ext/protobuf/CMakeLists.txt", add "-DCMAKE_POSITION_INDEPENDENT_CODE=ON;" after line 13 (quotation mark is needed) and have a try.

Thanks!