zhouwei-zhcy opened a new issue, #2127:
URL: https://github.com/apache/brpc/issues/2127
在example/echo_c++ 基础上,目标是想把client端编译链接成一个so动态库文件。加上-shared -fPIC 编译选项后,会报错误
gpu.pb.o: relocation R_X86_64_PC32 against symbol
`descriptor_table_gpu_2eproto' can not be used when making a shared object;
recompile with -fPIC
去掉-shared -fPIC可以正常编程出client可执行文件,
烦请专家大佬帮忙看看,是不是哪里配置不对?
/usr/local/bin/protoc --cpp_out=. --proto_path=. gpu.proto
> Compiling gpu.pb.o
g++ -c -I/usr/include/ -I/usr/local/include/
-I../../incubator-brpc//output/include -DBRPC_WITH_GLOG=0 -DGFLAGS_NS=google
-D__const__=__unused__ -g -std=c++0x -DNDEBUG -O2 -pipe -W -Wall
-Wno-unused-parameter -fno-omit-frame-pointer gpu.pb.cc -o gpu.pb.o
> Compiling client.o
g++ -c -I/usr/include/ -I/usr/local/include/
-I../../incubator-brpc//output/include -DBRPC_WITH_GLOG=0 -DGFLAGS_NS=google
-D__const__=__unused__ -g -std=c++0x -DNDEBUG -O2 -pipe -W -Wall
-Wno-unused-parameter -fno-omit-frame-pointer client.cpp -o client.o
client.cpp:73:93: warning: missing terminating ' character
/usr/bin/ld: gpu.pb.o: relocation R_X86_64_PC32 against symbol
`descriptor_table_gpu_2eproto' can not be used when making a shared object;
recompile with -fPIC
^
g++ -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib
-L../../incubator-brpc//output/lib -Xlinker "-(" gpu.pb.o client.o -Xlinker
"-)" -lgflags -lprotobuf -lleveldb -lsnappy -lbrpc -lpthread -lssl -lcrypto
-ldl -lz -lrt -shared -fPIC -o libclient.so
/usr/bin/ld: gpu.pb.o: relocation R_X86_64_PC32 against symbol
`descriptor_table_gpu_2eproto' can not be used when making a shared object;
recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:64: recipe for target 'client_so' failed
make: *** [client_so] Error 1
rm gpu.pb.cc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]