Open qinzhuzhu opened 2 years ago
Did you upgrade or downgrade protobuf library / compiler recently? Or installed protobuf from source instead of 'apt get'? Ubuntu 18.04 comes with protobuf 3.0.0: https://packages.ubuntu.com/bionic/protobuf-compiler Try
$ dpkg -l | grep libproto
(base) zhao@ubuntu:~/muduo$ ./build.sh
Do you know how this mistake was made and how to solve it
GitHub issues are for tracking bugs, not for general discussing like a forum.
If you have a general question to ask, send it to mailing list:
muduo-library@googlegroups.com
Or visit: https://groups.google.com/forum/#!forum/muduo-library
When file an issue muduo, please provide a SSCCE: Short, Self Contained, Correct (Compilable), Example.
If you can't compile muduo, make sure you install
cmake
andboost
from the official package repository, e.g.apt
oryum
, before opening a bug. Don't open a bug if you installed boost from a third-party source or downloaded it by yourself, and couldn't compile muduo, thank you.Also specify the exact environment where the issue occurs:
Linux distro and version? x86 or ARM? 32-bit or 64-bit?
Linux Ubuntu 18.04.6 LTS 64-bit
Branch (cpp98/cpp11/cpp17) and version of muduo?
cpp11 muduo-2.0.2
Version of cmake, gcc and boost? (If not from distro.)
cmake 3.10.2 gcc 7.5.0 boost 1.65.1 protoc --version libprotoc 2.6.1
运行 :./build.sh -j2 ++ pwd
muduo::Empty::~Empty()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:911: undefined reference to
google::protobuf::UnknownFieldSet::~UnknownFieldSet()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Empty::~Empty()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:911: undefined reference to
google::protobuf::UnknownFieldSet::~UnknownFieldSet()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:911: undefined reference togoogle::protobuf::Message::~Message()' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Empty::SerializeWithCachedSizesToArray(unsigned char) const': /usr/local/include/google/protobuf/io/coded_stream.h:1015: undefined reference to `google::protobuf::io::CodedOutputStream::WriteVarint32FallbackToArray(unsigned int, unsigned char)' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionvoid google::protobuf::internal::RepeatedPtrFieldBase::Destroy<google::protobuf::RepeatedPtrField<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::TypeHandler>() [clone .isra.44]': /usr/local/include/google/protobuf/repeated_field.h:869: undefined reference to
google::protobuf::internal::StringTypeHandlerBase::Delete(std::cxx11::basic_string<char, std::char_traitsgoogle::protobuf::io::CodedInputStream::ReadTagFallback()' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Answer::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream)': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:607: undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream, std::cxx11::basic_string<char, std::char_traitsgoogle::protobuf::internal::StringTypeHandlerBase::New[abi:cxx11]()' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Answer::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream)': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:641: undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream, std::google::protobuf::io::CodedInputStream::ReadVarint64Fallback(unsigned long*)' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Empty::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream)': /usr/local/include/google/protobuf/io/coded_stream.h:924: undefined reference togoogle::protobuf::io::CodedInputStream::ReadTagFallback()' /usr/local/include/google/protobuf/io/coded_stream.h:799: undefined reference to
google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Query::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)': /usr/local/include/google/protobuf/io/coded_stream.h:924: undefined reference to
google::protobuf::io::CodedInputStream::ReadTagFallback()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Query::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)': /usr/local/include/google/protobuf/repeated_field.h:905: undefined reference to
google::protobuf::internal::StringTypeHandlerBase::New[abi:cxx11]()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Query::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:279: undefined reference to
google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::google::protobuf::io::CodedInputStream::ReadVarint64Fallback(unsigned long*)' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Query::Query()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:163: undefined reference togoogle::protobuf::UnknownFieldSet::UnknownFieldSet()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:163: undefined reference to
google::protobuf::Message::~Message()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:163: undefined reference togoogle::protobuf::UnknownFieldSet::~UnknownFieldSet()' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Query::~Query()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:186: undefined reference togoogle::protobuf::UnknownFieldSet::~UnknownFieldSet()' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Query::MergeFrom(muduo::Query const&)': /usr/local/include/google/protobuf/repeated_field.h:905: undefined reference togoogle::protobuf::internal::StringTypeHandlerBase::New[abi:cxx11]()' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Query::Query(muduo::Query const&)': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:172: undefined reference togoogle::protobuf::UnknownFieldSet::UnknownFieldSet()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:172: undefined reference to
google::protobuf::Message::~Message()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:172: undefined reference togoogle::protobuf::UnknownFieldSet::~UnknownFieldSet()' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::Query::Swap(muduo::Query)': /usr/local/include/google/protobuf/repeated_field.h:1188: undefined reference to `google::protobuf::internal::RepeatedPtrFieldBase::Swap(google::protobuf::internal::RepeatedPtrFieldBase)' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Answer::Answer()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:499: undefined reference to
google::protobuf::UnknownFieldSet::UnknownFieldSet()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:499: undefined reference togoogle::protobuf::Message::~Message()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:499: undefined reference to
google::protobuf::UnknownFieldSet::~UnknownFieldSet()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Answer::~Answer()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:523: undefined reference to
google::protobuf::UnknownFieldSet::~UnknownFieldSet()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Answer::MergeFrom(muduo::Answer const&)': /usr/local/include/google/protobuf/repeated_field.h:905: undefined reference to
google::protobuf::internal::StringTypeHandlerBase::New[abi:cxx11]()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Answer::Answer(muduo::Answer const&)': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:508: undefined reference to
google::protobuf::UnknownFieldSet::UnknownFieldSet()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:508: undefined reference togoogle::protobuf::Message::~Message()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:508: undefined reference to
google::protobuf::UnknownFieldSet::~UnknownFieldSet()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Answer::Swap(muduo::Answer*)': /usr/local/include/google/protobuf/repeated_field.h:1188: undefined reference to
google::protobuf::internal::RepeatedPtrFieldBase::Swap(google::protobuf::internal::RepeatedPtrFieldBase)' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Empty::Empty()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:890: undefined reference to
google::protobuf::UnknownFieldSet::UnknownFieldSet()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:890: undefined reference togoogle::protobuf::Message::~Message()' ../../../lib/libquery_proto.a(query.pb.cc.o): In function
muduo::protobuf_AssignDesc_query_2eproto()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:58: undefined reference to `google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google::protobuf::Descriptor const, google::protobuf::Message const, int const, int, int, int, google::protobuf::DescriptorPool const, google::protobuf::MessageFactory, int)' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:76: undefined reference togoogle::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google::protobuf::Descriptor const*, google::protobuf::Message const*, int const*, int, int, int, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, int)' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:91: undefined reference to
google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google::protobuf::Descriptor const, google::protobuf::Message const, int const, int, int, int, google::protobuf::DescriptorPool const, google::protobuf::MessageFactory*, int)' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Empty::Empty(muduo::Empty const&)': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:899: undefined reference to
google::protobuf::UnknownFieldSet::UnknownFieldSet()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:899: undefined reference togoogle::protobuf::Message::~Message()' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:899: undefined reference to
google::protobuf::UnknownFieldSet::~UnknownFieldSet()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Empty::~Empty()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:911: undefined reference to
google::protobuf::Message::~Message()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Query::~Query()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:186: undefined reference to
google::protobuf::Message::~Message()' ../../../lib/libquery_proto.a(query.pb.cc.o): In functionmuduo::Answer::~Answer()': /build/release-cpp11/examples/protobuf/codec/query.pb.cc:523: undefined reference to
google::protobuf::Message::~Message()' collect2: error: ld returned 1 exit status examples/protobuf/codec/CMakeFiles/protobuf_dispatcher_lite_test.dir/build.make:95: recipe for target 'bin/protobuf_dispatcher_lite_test' failed make[2]: [bin/protobuf_dispatcher_lite_test] Error 1 CMakeFiles/Makefile2:6142: recipe for target 'examples/protobuf/codec/CMakeFiles/protobuf_dispatcher_lite_test.dir/all' failed make[1]: [examples/protobuf/codec/CMakeFiles/protobuf_dispatcher_lite_test.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 23%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/Poller.cc.o [ 23%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/poller/DefaultPoller.cc.o [ 24%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/poller/EPollPoller.cc.o [ 24%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/poller/PollPoller.cc.o [ 24%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/Socket.cc.o [ 24%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/SocketsOps.cc.o [ 25%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/TcpClient.cc.o [ 25%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/TcpConnection.cc.o [ 25%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/TcpServer.cc.o [ 25%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/Timer.cc.o [ 26%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/TimerQueue.cc.o [ 26%] Linking CXX static library ../../lib/libmuduo_net.a [ 26%] Built target muduo_net Makefile:140: recipe for target 'all' failed make: [all] Error 2