Я компилирую chromium epoll_quic_client с g ++ - 7 и получаю ошибку при компоновке - PullRequest
0 голосов
/ 17 октября 2019

Я компилирую chromium epoll_quic_client с помощью g ++ - 7 и получаю ошибку при связывании.

Вот описание ошибки:

[234/234] LINK ./epoll_quic_client
FAILED: epoll_quic_client 
g++ -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=gold -B../../third_party/binutils/Linux_x64/Release/bin -Wl,--threads -Wl,--thread-count=4 -Wl,--icf=all -m64 -Wl,-O2 -Wl,--gc-sections -rdynamic -pie -Wl,--disable-new-dtags -Wl,-rpath=\$ORIGIN -o "./epoll_quic_client" -Wl,--start-group @"./epoll_quic_client.rsp" ./libnet.so ./libbase.so ./libboringssl.so ./libprotobuf_lite.so ./libcrcrypto.so ./liburl.so -Wl,--end-group  -latomic -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4
obj/net/epoll_quic_client/quic_toy_client.o:quic_toy_client.cc:function quic::QuicFlagSetup<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::QuicFlagSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*): error: undefined reference to 'vtable for quic::TypedQuicFlagHelper<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
obj/net/epoll_quic_client/quic_toy_client.o:quic_toy_client.cc:function quic::QuicFlagSetup<int>::QuicFlagSetup(int*, char const*, int const&, char const*): error: undefined reference to 'vtable for quic::TypedQuicFlagHelper<int>'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
obj/net/epoll_quic_client/quic_toy_client.o:quic_toy_client.cc:function quic::QuicFlagSetup<bool>::QuicFlagSetup(bool*, char const*, bool const&, char const*): error: undefined reference to 'vtable for quic::TypedQuicFlagHelper<bool>'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
obj/net/simple_quic_tools/quic_default_proof_providers_impl.o:quic_default_proof_providers_impl.cc:function _GLOBAL__sub_I_quic_default_proof_providers_impl.cc: error: undefined reference to 'vtable for quic::TypedQuicFlagHelper<bool>'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

заголовочный файл: net/quic/platform/impl/quic_flags_impl.h

// Abstract class for setting flags and fetching help strings.
class QuicFlagHelper {
 public:
  explicit QuicFlagHelper(const char* help) : help_(help) {}
  virtual ~QuicFlagHelper() = default;

  virtual bool SetFlag(const std::string& value)const = 0;  
  virtual void ResetFlag()const = 0;
  std::string GetHelp() const { return help_; }

 private:
  std::string help_;
};

// Templated class for setting flags of various types.
template <typename T>
class TypedQuicFlagHelper : public QuicFlagHelper {
 public:
  TypedQuicFlagHelper(T* flag, const T& default_value, const char* help)
      : QuicFlagHelper(help), flag_(flag), default_value_(default_value) {}
  bool SetFlag(const std::string& value) const override;
  void ResetFlag() const override { *flag_ = default_value_; }

 private:
  mutable T* flag_;
  T default_value_;
};

Функции SetFlag и ResetFlag реализованы в net/quic/platform/impl/quic_flags_impl.cc,Я уверен, что эти функции буксировки были реализованы. Я извлекаю эти классы в своем тестовом проекте, но он работает нормально.

out/xxx/args.gn
target_os = "linux"
target_cpu = "x64"
use_sysroot = false
is_clang = false
is_debug = false
is_component_build = true
treat_warnings_as_errors = false
symbol_level = 0 
disable_file_support = true
disable_ftp_support = true
enable_websockets = false
enable_nacl = false
remove_webcore_debug_symbols = true
use_jumbo_build = true
use_custom_libcxx_for_host=false
use_custom_libcxx=false
libcxx_abi_unstable=false
...