You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "zhouwei-zhcy (via GitHub)" <gi...@apache.org> on 2023/02/16 11:18:48 UTC

[I] 求助:brpc client端编译so文件失败 (brpc)

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: dev-unsubscribe@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 求助:brpc client端编译so文件失败 (brpc)

Posted by "zhouwei-zhcy (via GitHub)" <gi...@apache.org>.
zhouwei-zhcy closed issue #2127: 求助:brpc client端编译so文件失败
URL: https://github.com/apache/brpc/issues/2127


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 求助:brpc client端编译so文件失败 (brpc)

Posted by "zhouwei-zhcy (via GitHub)" <gi...@apache.org>.
zhouwei-zhcy commented on issue #2127:
URL: https://github.com/apache/brpc/issues/2127#issuecomment-1432988081

   小问题已解决-_-||


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org