Observed by @fanquake in #21935#pullrequestreview-683513857
(depends build) Boost Process seems to use Boost ASIO, which uses
std::allocator<void>
, which was deprecated in C++17. This leads to a nice stack of warnings, at least on macOS:0bitcoin/depends/x86_64-apple-darwin20.5.0/include/boost/asio/associated_allocator.hpp:78:49: warning: 'allocator<void>' is deprecated [-Wdeprecated-declarations] 1template <typename T, typename Allocator = std::allocator<void> > 2 ^ 3/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:730:28: note: 'allocator<void>' has been explicitly marked deprecated here 4class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void> 5 ^ 6/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:1058:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17' 7# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED 8 ^ 9/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:1035:48: note: expanded from macro '_LIBCPP_DEPRECATED' 10# define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
I’m also seeing unused-result warnings (from Boost) when building on my Ubuntu machine:
0In file included from /home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/process/detail/execute_impl.hpp:24, 1 from /home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/process/child.hpp:22, 2 from /home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/process/async_system.hpp:22, 3 from /home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/process.hpp:24, 4 from util/system.cpp:9: 5/home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/process/detail/posix/executor.hpp: In member function ‘void boost::process::detail::posix::executor<Sequence>::write_error(const std::error_code&, const char*) [with Sequence = boost::fusion::joint_view<boost::fusion::tuple<boost::process::detail::posix::exe_cmd_init<char> >, boost::fusion::filter_view<const boost::fusion::tuple<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::process::detail::posix::pipe_out<1, -1>&, boost::process::detail::posix::pipe_out<2, -1>&, boost::process::detail::posix::pipe_in&>, boost::process::detail::is_initializer<mpl_::arg<-1> > > >]’: 6/home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/process/detail/posix/executor.hpp:156:16: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 156 | ::write(_pipe_sink, &len, sizeof(int)); 8 | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9/home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/process/detail/posix/executor.hpp:159:16: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 159 | ::write(_pipe_sink, &len, sizeof(int)); 11 | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12/home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/process/detail/posix/executor.hpp:160:16: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 160 | ::write(_pipe_sink, msg, len); 14 | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ 15 AR libbitcoin_util.a
I tried with Boost 1.72 - 1.76 (most recent version on 2021-06-15) but to no avail.
Possible solutions:
- fix it upstream (using a patch in the mean time):
- by fixing ASIO, but this has been tried since 2018: https://github.com/boostorg/asio/pull/76
- by fixing Process to not use Asio perhaps
- refactoring
RunCommandParseJSON
to work without Boost::Process (sadly non trivial, see #15382) - make llvm not complain: https://bugs.llvm.org/show_bug.cgi?id=50299
In addition to annoying warnings, this would require someone with a c++20 compiler to use --disable-external-signer
.