提升ASIO的未定义引用

2022-08-21 00:00:00 bazel ssl c++ boost
我在使用Bazelboost构建opt模式时遇到问题。这是我的错误。

bazel-out/k8-opt/bin/src/_objs/wallet/message_store.o:message_store.cpp:function _GLOBAL__sub_I__ZN3mms13message_storeC2ESt10unique_ptrIN4epee9net_utils4http20abstract_http_clientESt14default_deleteIS5_EE: error: undefined reference to 'boost::asio::ssl::error::get_stream_category()'
bazel-out/k8-opt/bin/src/_objs/wallet/wallet_rpc_payments.o:wallet_rpc_payments.cpp:function _GLOBAL__sub_I__ZNK5tools7wallet220get_client_signatureB5cxx11Ev: error: undefined reference to 'boost::asio::ssl::error::get_stream_category()'
bazel-out/k8-opt/bin/src/_objs/wallet/wallet2.o:wallet2.cpp:function _GLOBAL__sub_I__ZN5tools7wallet227default_daemon_address_lockE: error: undefined reference to 'boost::asio::ssl::error::get_stream_category()'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function epee::net_utils::http::http_simple_client_template<epee::net_utils::blocked_mode_client>::set_server(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::optional<epee::net_utils::http::login>, epee::net_utils::ssl_options_t): error: undefined reference to 'boost::asio::ssl::context::operator=(boost::asio::ssl::context&&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function epee::net_utils::http::http_simple_client_template<epee::net_utils::blocked_mode_client>::set_server(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::optional<epee::net_utils::http::login>, epee::net_utils::ssl_options_t): error: undefined reference to 'boost::asio::ssl::context::context(boost::asio::ssl::context_base::method)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function epee::net_utils::http::http_simple_client_template<epee::net_utils::blocked_mode_client>::set_server(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::optional<epee::net_utils::http::login>, epee::net_utils::ssl_options_t): error: undefined reference to 'boost::asio::ssl::context::operator=(boost::asio::ssl::context&&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function std::_Sp_counted_ptr<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >*, (__gnu_cxx::_Lock_policy)2>::_M_dispose(): error: undefined reference to 'boost::asio::ssl::detail::engine::~engine()'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::stream_core::~stream_core(): error: undefined reference to 'boost::asio::ssl::detail::engine::~engine()'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::stream<boost::asio::io_context&>(boost::asio::io_context&, boost::asio::ssl::context&): error: undefined reference to 'boost::asio::ssl::context::native_handle()'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::stream<boost::asio::io_context&>(boost::asio::io_context&, boost::asio::ssl::context&): error: undefined reference to 'boost::asio::ssl::detail::engine::engine(ssl_ctx_st*)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::stream<boost::asio::io_context&>(boost::asio::io_context&, boost::asio::ssl::context&): error: undefined reference to 'boost::asio::ssl::detail::engine::~engine()'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::shutdown_op, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::shutdown(boost::system::error_code&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::shutdown_op, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::put_input(boost::asio::const_buffer const&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::shutdown_op, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::shutdown(boost::system::error_code&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::shutdown_op, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::get_output(boost::asio::mutable_buffer const&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::shutdown_op, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::put_input(boost::asio::const_buffer const&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function net::http::client_factory::create(): error: undefined reference to 'boost::asio::ssl::context::context(boost::asio::ssl::context_base::method)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::write_op<boost::asio::const_buffers_1>, boost::asio::detail::write_op<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::const_buffers_1, boost::asio::const_buffer const*, boost::asio::detail::transfer_all_t, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::write(boost::asio::const_buffer const&, boost::system::error_code&, unsigned long&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::write_op<boost::asio::const_buffers_1>, boost::asio::detail::write_op<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::const_buffers_1, boost::asio::const_buffer const*, boost::asio::detail::transfer_all_t, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::put_input(boost::asio::const_buffer const&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::write_op<boost::asio::const_buffers_1>, boost::asio::detail::write_op<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::const_buffers_1, boost::asio::const_buffer const*, boost::asio::detail::transfer_all_t, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::write(boost::asio::const_buffer const&, boost::system::error_code&, unsigned long&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::write_op<boost::asio::const_buffers_1>, boost::asio::detail::write_op<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::const_buffers_1, boost::asio::const_buffer const*, boost::asio::detail::transfer_all_t, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::get_output(boost::asio::mutable_buffer const&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::write_op<boost::asio::const_buffers_1>, boost::asio::detail::write_op<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::const_buffers_1, boost::asio::const_buffer const*, boost::asio::detail::transfer_all_t, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::identity<boost::system::error_code&> >, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > > >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::put_input(boost::asio::const_buffer const&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::read_op<boost::asio::mutable_buffers_1>, boost::asio::detail::read_op<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::mutable_buffers_1, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_at_least_t, epee::net_utils::blocked_mode_client::handler_obj> >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::read(boost::asio::mutable_buffer const&, boost::system::error_code&, unsigned long&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::read_op<boost::asio::mutable_buffers_1>, boost::asio::detail::read_op<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::mutable_buffers_1, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_at_least_t, epee::net_utils::blocked_mode_client::handler_obj> >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::read(boost::asio::mutable_buffer const&, boost::system::error_code&, unsigned long&)'
bazel-out/k8-opt/bin/src/_objs/net/http.o:http.cpp:function boost::asio::ssl::detail::io_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::ssl::detail::read_op<boost::asio::mutable_buffers_1>, boost::asio::detail::read_op<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::mutable_buffers_1, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_at_least_t, epee::net_utils::blocked_mode_client::handler_obj> >::operator()(boost::system::error_code, unsigned long, int): error: undefined reference to 'boost::asio::ssl::detail::engine::get_output(boost::asio::mutable_buffer const&)'

我的生成文件如下所示。

cc_binary(
    name = "denarii_wallet_cli",
    srcs = [
        "simplewallet.cpp",
        "simplewallet.h",
    ],
    linkopts = [
        "-lssl",
        "-lcrypto",
        "-ldl",
        "-lpthread",
        "-lboost_system",
        "-lboost_thread",
    ],
    deps = [
        "//contrib/epee",
        "//src:cncrypto",
        "//src:common",
        "//src:cryptonote_core",
        "//src:cryptonote_protocol",
        "//src:rpc_base",
        "//src:version",
        "//src:wallet",
        "//src/mnemonics",
        "@boost//:asio",
        "@boost//:chrono",
        "@boost//:filesystem",
        "@boost//:locale",
        "@boost//:program_options",
        "@boost//:system",
        "@boost//:thread",
        "@liblzma",
        "@libreadline",
        "@openssl//:libcrypto",
        "@openssl//:libssl",
        "@qrcodegen",
    ],
)

它在dbgfastbuild模式下构建良好。所以我不知道为什么这不管用。如果人们有其他问题我不知道该提供什么,我可以提供更多信息:)

我还看到其他类似的问题:undefined reference to `boost::system::generic_category()' when adding boost/asio

Boost

对于https://github.com/nelhage/rules_boost,您需要包含";@推荐答案//:asio_ssl";才能正常工作。:),并在上面的问题中包括链接器标志。

相关文章