Skip to content

muduo-protorpc编译失败 #4

@Ross-Fan

Description

@Ross-Fan

ubuntu环境:
Linux version 5.4.0-42-generic (buildd@lgw01-amd64-038) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04

protorpc环境:
protoc --version
libprotoc 3.19.4

发生问题的操作:
执行:
$ sudo apt-get install libprotoc-dev protobuf-compiler
$ sudo apt-get install libprotobuf-dev cmake
$ git clone https://github.com/chenshuo/muduo.git
$ git clone https://github.com/chenshuo/muduo-protorpc.git
在执行完上述操作后,执行:
cd muduo && git checkout cpp11 && ./build.sh install
报错:
[ 35%] Built target timerqueue_unittest
[ 36%] Built target muduo_protobuf_codec
[ 37%] Built target muduo_protorpc_wire
[ 37%] Built target muduo_protorpc
[ 37%] Linking CXX executable ../../../bin/protobuf_rpc_wire_test
/usr/bin/ld: ../../../lib/libmuduo_protorpc_wire.a(rpc.pb.cc.o): in function muduo::net::RpcMessage::SharedDtor()': /home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:260: undefined reference to google::protobuf::internal::ArenaStringPtr::Destroy()'
/usr/bin/ld: /home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:261: undefined reference to google::protobuf::internal::ArenaStringPtr::Destroy()' /usr/bin/ld: /home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:262: undefined reference to google::protobuf::internal::ArenaStringPtr::Destroy()'
/usr/bin/ld: /home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:263: undefined reference to google::protobuf::internal::ArenaStringPtr::Destroy()' /usr/bin/ld: ../../../lib/libmuduo_protorpc_wire.a(rpc.pb.cc.o): in function muduo::net::RpcMessage::_internal_mutable_responseabi:cxx11':
/home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.h:690: undefined reference to google::protobuf::internal::ArenaStringPtr::Mutable[abi:cxx11](google::protobuf::Arena*)' /usr/bin/ld: ../../../lib/libmuduo_protorpc_wire.a(rpc.pb.cc.o): in function muduo::net::RpcMessage::RpcMessage(muduo::net::RpcMessage const&)':
/home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:216: undefined reference to google::protobuf::internal::ArenaStringPtr::Set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Arena*)' /usr/bin/ld: /home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:208: undefined reference to google::protobuf::internal::ArenaStringPtr::Set(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, google::protobuf::Arena*)'
/usr/bin/ld: /home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:200: undefined reference to google::protobuf::internal::ArenaStringPtr::Set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Arena*)' /usr/bin/ld: /home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:192: undefined reference to google::protobuf::internal::ArenaStringPtr::Set(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, google::protobuf::Arena*)'
/usr/bin/ld: ../../../lib/libmuduo_protorpc_wire.a(rpc.pb.cc.o): in function muduo::net::RpcMessage::_internal_set_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.h:550: undefined reference to google::protobuf::internal::ArenaStringPtr::Set(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, google::protobuf::Arena*)'
/usr/bin/ld: ../../../lib/libmuduo_protorpc_wire.a(rpc.pb.cc.o):/home/cambricon/study/fmuduo/build/release-cpp11/muduo/net/protorpc/rpc.pb.h:618: more undefined references to `google::protobuf::internal::ArenaStringPtr::Set(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, google::protobuf::Arena*)' follow
collect2: error: ld returned 1 exit status
make[2]: *** [muduo/net/protorpc/CMakeFiles/protobuf_rpc_wire_test.dir/build.make:88:bin/protobuf_rpc_wire_test] 错误 1
make[1]: *** [CMakeFiles/Makefile2:2528:muduo/net/protorpc/CMakeFiles/protobuf_rpc_wire_test.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2

ps:
电脑上的protocbuff是提前装好了,但是还是执行了
$ sudo apt-get install libprotoc-dev protobuf-compiler
$ sudo apt-get install libprotobuf-dev cmake
这两个命令
另外,在编译muduo-protorpc之前,我基于手动安装过的protoc版本去编译muduo是可以编译通过的,并且 example下面的rpc有关的可执行文件在bin中都是正常生成的
所以不确定是那里操作有问题?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions