Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

安装报错,protobuf #553

Open
qinzhuzhu opened this issue May 2, 2022 · 2 comments
Open

安装报错,protobuf #553

qinzhuzhu opened this issue May 2, 2022 · 2 comments

Comments

@qinzhuzhu
Copy link

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:

[email protected]

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 and boost from the
official package repository, e.g. apt or yum, 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

  • SOURCE_DIR=/muduo-2.0.0
  • BUILD_DIR=../build
  • BUILD_TYPE=release
  • INSTALL_DIR=../release-install-cpp11
  • CXX=g++
  • ln -sf ../build/release-cpp11/compile_commands.json
  • mkdir -p ../build/release-cpp11
  • cd ../build/release-cpp11
  • cmake -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=../release-install-cpp11 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /muduo-2.0.0
    -- The C compiler identification is GNU 7.5.0
    -- The CXX compiler identification is GNU 7.5.0
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Boost version: 1.65.1
    -- Looking for pthread.h
    -- Looking for pthread.h - found
    -- Looking for pthread_create
    -- Looking for pthread_create - not found
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - found
    -- Found Threads: TRUE
    -- Found Protobuf: /usr/local/lib/libprotobuf.so;-lpthread (found version "2.6.1")
    -- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.58.0")
    -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
    -- found cares
    -- found curl
    -- found protobuf
    -- found zlib
    -- CXX_FLAGS = -g -DCHECK_PTHREAD_RETURN_VALUE -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Werror -Wconversion -Wno-unused-parameter -Wold-style-cast -Woverloaded-virtual -Wpointer-arith -Wshadow -Wwrite-strings -march=native -std=c++11 -rdynamic -O2 -DNDEBUG
    -- Looking for accept4
    -- Looking for accept4 - found
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /build/release-cpp11
  • make -j2
    Scanning dependencies of target atomic_unittest
    Scanning dependencies of target muduo_base
    [ 0%] Building CXX object muduo/base/tests/CMakeFiles/atomic_unittest.dir/Atomic_unittest.cc.o
    [ 0%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/AsyncLogging.cc.o
    ...
    [ 20%] Building CXX object examples/sudoku/CMakeFiles/sudoku_stat_unittest.dir/stat_unittest.cc.o
    [ 20%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/Buffer.cc.o
    [ 20%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/Channel.cc.o
    [ 21%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/Connector.cc.o
    [ 21%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/EventLoop.cc.o
    [ 21%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/EventLoopThread.cc.o
    [ 22%] Linking CXX executable ../../bin/sudoku_stat_unittest
    [ 22%] Built target sudoku_stat_unittest
    Scanning dependencies of target protobuf_dispatcher_lite_test
    [ 22%] Building CXX object examples/protobuf/codec/CMakeFiles/protobuf_dispatcher_lite_test.dir/dispatcher_lite_test.cc.o
    [ 22%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/EventLoopThreadPool.cc.o
    [ 23%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/InetAddress.cc.o
    [ 23%] Linking CXX executable ../../../bin/protobuf_dispatcher_lite_test
    ../../../lib/libquery_proto.a(query.pb.cc.o): In function 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 function muduo::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 to google::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 function void google::protobuf::internal::RepeatedPtrFieldBase::Destroy<google::protobuf::RepeatedPtrField<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >::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_traits<char>, std::allocator<char> >*)' ../../../lib/libquery_proto.a(query.pb.cc.o): In function muduo::Answer::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 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_traits<char>, std::allocator<char> >*)' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:624: undefined reference to google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)'
    ../../../lib/libquery_proto.a(query.pb.cc.o): In function muduo::Answer::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)': /usr/local/include/google/protobuf/repeated_field.h:905: undefined reference to google::protobuf::internal::StringTypeHandlerBase::Newabi: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::__cxx11::basic_string<char, std::char_traits, std::allocator >)'
    /build/release-cpp11/examples/protobuf/codec/query.pb.cc:641: undefined reference to google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' ../../../lib/libquery_proto.a(query.pb.cc.o): In function muduo::Answer::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream
    )':
    /usr/local/include/google/protobuf/io/coded_stream.h:809: undefined reference to 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 to google::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 function muduo::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 function muduo::Query::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)': /usr/local/include/google/protobuf/repeated_field.h:905: undefined reference to google::protobuf::internal::StringTypeHandlerBase::Newabi:cxx11'
    ../../../lib/libquery_proto.a(query.pb.cc.o): In function muduo::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::__cxx11::basic_string<char, std::char_traits, std::allocator >)'
    /build/release-cpp11/examples/protobuf/codec/query.pb.cc:279: undefined reference to google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' /build/release-cpp11/examples/protobuf/codec/query.pb.cc:262: undefined reference to google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream
    , std::__cxx11::basic_string<char, std::char_traits, std::allocator >)'
    ../../../lib/libquery_proto.a(query.pb.cc.o): In function muduo::Query::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)': /usr/local/include/google/protobuf/io/coded_stream.h:809: undefined reference to 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 to google::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 to google::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 to google::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 to google::protobuf::internal::StringTypeHandlerBase::Newabi: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 to google::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 to google::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 function muduo::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 to google::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 function muduo::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 function muduo::Answer::MergeFrom(muduo::Answer const&)': /usr/local/include/google/protobuf/repeated_field.h:905: undefined reference to google::protobuf::internal::StringTypeHandlerBase::Newabi:cxx11'
    ../../../lib/libquery_proto.a(query.pb.cc.o): In function muduo::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 to google::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 function muduo::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 function muduo::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 to google::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 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: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 function muduo::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 to google::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 function muduo::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 function muduo::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 function muduo::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
@chenshuo
Copy link
Owner

chenshuo commented May 2, 2022

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

@SLwarrior
Copy link

(base) zhao@ubuntu:~/muduo$ ./build.sh

  • pwd
  • SOURCE_DIR=/home/zhao/muduo
  • BUILD_DIR=/home/zhao/muduo/build
  • BUILD_TYPE=release
  • INSTALL_DIR=/home/zhao/muduo/release-install-cpp11
  • CXX=g++
  • ln -sf /home/zhao/muduo/build/release-cpp11/compile_commands.json
  • mkdir -p /home/zhao/muduo/build/release-cpp11
  • cd /home/zhao/muduo/build/release-cpp11
  • cmake -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/home/zhao/muduo/release-install-cpp11 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /home/zhao/muduo
    ./build.sh: 15: cmake: Too many levels of symbolic links

Do you know how this mistake was made and how to solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants