Boost::ASIO (used by Boost::Process) uses (falsely?) deprecated std::allocator #22254

issue Sjors openend this issue on June 15, 2021
  1. Sjors commented at 7:04 pm on June 15, 2021: member

    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:

    In addition to annoying warnings, this would require someone with a c++20 compiler to use --disable-external-signer.

  2. Sjors added the label Bug on Jun 15, 2021
  3. Sjors renamed this:
    Boost::ASIO (used by Boost::Process) uses deprecated std::allocator
    Boost::ASIO (used by Boost::Process) uses (falsely?) deprecated std::allocator
    on Jun 15, 2021
  4. akhil14shukla commented at 12:44 pm on July 4, 2021: none
    I checked the repo for boost/asio dependency, and I didn’t find any trace of it in the search results. It seems that while building we check the BOOST library thus also checking the boost/asio and leading to warnings. Adding a condition to skip this boost/asio should suppress the warnings.
  5. Sjors commented at 9:36 am on July 6, 2021: member

    I tried removing boost/asio from depends with a patch, but we do seem to need it:

    0In file included from util/system.cpp:14:
    1In file included from /Users/sjors/dev/bitcoin/depends/x86_64-apple-darwin20.5.0/include/boost/process.hpp:23:
    2/Users/sjors/dev/bitcoin/depends/x86_64-apple-darwin20.5.0/include/boost/process/async.hpp:35:10: fatal error: 'boost/asio/io_context.hpp' file not found
    3#include <boost/asio/io_context.hpp>
    4         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    51 error generated.
    6make[2]: *** [util/libbitcoin_util_a-system.o] Error 1
    
  6. Sjors commented at 12:23 pm on April 29, 2022: member
    Hopefully we can replace Boost::Process altogether, see #24907
  7. fanquake commented at 7:40 pm on August 8, 2022: member
    std::allocator<void> was undeprecated in LLVM: https://github.com/llvm/llvm-project/commit/87784cc6fb3453a17e0e7826b943a1d93cbfeccf. There’s no need for us to keep an issue open for this for now.
  8. fanquake closed this on Aug 8, 2022

  9. bitcoin locked this on Aug 8, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-04 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me