问题
I am having issues building with opt
mode with Bazel
and boost
. Here is my error.
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&)'
My build file looks like the following.
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",
],
)
It builds fine in dbg
and fastbuild
modes. So I have no clue why this isn't working. I can provide more info if people have other questions I just don't know what to provide :)
I have also seen other similar issues like: undefined reference to `boost::system::generic_category()' when adding boost/asio
来源:https://stackoverflow.com/questions/65411141/undefined-reference-to-boost-asio