From ecfe30c72f11fa5156874819a8231d04bd6ee47f Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Wed, 20 Nov 2024 21:49:29 +0100 Subject: [PATCH] build: boost, prevent use of std::unary_function (#640) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build: boost, prevent use of std::unary_function For Boost 1.72 we should use -D_HAS_AUTO_PTR_ETC=0, for newer versions -DBOOST_NO_CXX98_FUNCTION_BASE. - https://github.com/boostorg/container_hash/commit/fd310d27065dbd54e27c3319385e94bea1d3b51d - https://github.com/boostorg/functional/commit/6a573e4b8333ee63ee62ce95558c3667348db233 - https://github.com/bitcoin/bitcoin/commit/880d4aaf81f3d5d7fbb915905c2e61b816a6a747 - https://github.com/bitcoin/bitcoin/commit/d4c59da8d6e3aac14306249aa12332fed55efebd - https://github.com/DeckerSU/KomodoOcean/commit/07420481c13b9ad13d4fac511a078eb0daabd0c1 This will remove warnings like the one shown below during build with GCC 13: ``` /home/decker/komodo/depends/x86_64-unknown-linux-gnu/share/../include/boost/container_hash/hash.hpp:130:33: warning: ‘template struct std::unary_function’ is deprecated [-Wdeprecated-declarations] 130 | struct hash_base : std::unary_function {}; | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/13/string:49, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /home/decker/komodo/depends/x86_64-unknown-linux-gnu/share/../include/gtest/gtest.h:55, from test-komodo/test_legacy_events.cpp:1: /usr/include/c++/13/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function | ^~~~~~~~~~~~~~ ``` * build: add BOOST_CPPFLAGS display for configure --- configure.ac | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 82e9e5135e..a6df8be747 100644 --- a/configure.ac +++ b/configure.ac @@ -629,6 +629,16 @@ AX_BOOST_PROGRAM_OPTIONS AX_BOOST_THREAD AX_BOOST_CHRONO +dnl Prevent use of std::unary_function, which was removed in C++17, +dnl and will generate warnings with newer compilers for Boost +dnl older than 1.80. +dnl See: https://github.com/boostorg/container_hash/issues/22, https://github.com/boostorg/config/pull/430. + +dnl _HAS_AUTO_PTR_ETC check required only for boost 1.72 and older, since 1.73 we can use BOOST_NO_CXX98_FUNCTION_BASE +AX_CHECK_PREPROC_FLAG([-D_HAS_AUTO_PTR_ETC=0], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -D_HAS_AUTO_PTR_ETC=0"], [], [$CXXFLAG_WERROR], + [AC_LANG_PROGRAM([[#include ]])]) +AX_CHECK_PREPROC_FLAG([-DBOOST_NO_CXX98_FUNCTION_BASE], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"], [], [$CXXFLAG_WERROR], + [AC_LANG_PROGRAM([[#include ]])]) fi if test x$use_reduce_exports = xyes; then @@ -933,21 +943,22 @@ esac echo echo "Options used to compile and link:" -echo " with wallet = $enable_wallet" -echo " with proton = $use_proton" -echo " with zmq = $use_zmq" -echo " with test = $use_tests" -echo " debug enabled = $enable_debug" -echo " werror = $enable_werror" +echo " with wallet = $enable_wallet" +echo " with proton = $use_proton" +echo " with zmq = $use_zmq" +echo " with test = $use_tests" +echo " debug enabled = $enable_debug" +echo " werror = $enable_werror" echo -echo " target os = $TARGET_OS" -echo " build os = $BUILD_OS" +echo " target os = $TARGET_OS" +echo " build os = $BUILD_OS" echo -echo " CC = $CC" -echo " CFLAGS = $CFLAGS" -echo " CPPFLAGS = $CPPFLAGS" -echo " CXX = $CXX" -echo " CXXFLAGS = $CXXFLAGS" -echo " LDFLAGS = $LDFLAGS" -echo " ARFLAGS = $ARFLAGS" +echo " CC = $CC" +echo " CFLAGS = $CFLAGS" +echo " CPPFLAGS = $CPPFLAGS" +echo " CXX = $CXX" +echo " CXXFLAGS = $CXXFLAGS" +echo " BOOST_CPPFLAGS = $BOOST_CPPFLAGS" +echo " LDFLAGS = $LDFLAGS" +echo " ARFLAGS = $ARFLAGS" echo