imzhenyu / rDSN

Robust Distributed System Nucleus (rDSN) is an open framework for quickly building and managing high performance and robust distributed systems.
MIT License
33 stars 11 forks source link

protobuf is ok? #552

Open zdy0009 opened 5 years ago

zdy0009 commented 5 years ago

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?

linmajia commented 5 years ago

@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!