diff --git a/CMakeLists.txt b/CMakeLists.txt index 821ec5fba..64b180ad6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,27 @@ cmake_minimum_required(VERSION 3.12) +# CMake 4.x removed compatibility with cmake_minimum_required(<3.5), which +# several bundled subprojects (bls, secp256k1, leveldb, univalue, qt) still +# declare. Allow them to configure under modern CMake. +if(NOT DEFINED CMAKE_POLICY_VERSION_MINIMUM) + set(CMAKE_POLICY_VERSION_MINIMUM 3.5) +endif() + project(devault VERSION 1.2.1 # DESCRIPTION "DeVault is a full node implementation of the DeVault protocol." # HOMEPAGE_URL "https://www.devault.cc" ) +# Modern libstdc++ (GCC 13+) no longer transitively includes many standard +# headers (, , containers, ...) that this 2019-era code +# relied on. Force-include a small compatibility prelude into every C++ TU +# instead of editing hundreds of files. +add_compile_options( + "$<$:-include;${CMAKE_CURRENT_SOURCE_DIR}/src/compat/modern_prelude.h>" +) + enable_testing() # Package information diff --git a/cmake/modules/FindBerkeleyDB.cmake b/cmake/modules/FindBerkeleyDB.cmake index c71865f5a..d5fc284bd 100644 --- a/cmake/modules/FindBerkeleyDB.cmake +++ b/cmake/modules/FindBerkeleyDB.cmake @@ -10,19 +10,21 @@ find_brew_prefix(BREW_HINT berkeley-db) find_path(BDB_INCLUDE_DIR NAMES db.h + PATH_SUFFIXES db5.3 db5 db4.8 db4 HINTS ${BREW_HINT} ) find_library(BDB_LIBRARY - NAMES db libdb + NAMES db libdb db-5.3 db-5 db-4.8 HINTS ${BREW_HINT} ) find_path(BDBXX_INCLUDE_DIR NAMES db_cxx.h + PATH_SUFFIXES db5.3 db5 db4.8 db4 HINTS ${BREW_HINT} ) find_library(BDBXX_LIBRARY - NAMES db_cxx libdb_cxx + NAMES db_cxx libdb_cxx db_cxx-5.3 db_cxx-5 db_cxx-4.8 HINTS ${BREW_HINT} ) diff --git a/cmake/modules/FindMiniupnpc.cmake b/cmake/modules/FindMiniupnpc.cmake index c2b0b8db3..4ef7138f1 100644 --- a/cmake/modules/FindMiniupnpc.cmake +++ b/cmake/modules/FindMiniupnpc.cmake @@ -21,7 +21,10 @@ if(MINIUPNPC_INCLUDE_DIR) set(CMAKE_REQUIRED_INCLUDES ${MINIUPNPC_INCLUDE_DIR}) foreach(_miniupnpc_header ${MINIUPNPC_REQUIRED_HEADERS}) sanitize_variable(HAVE_MINIUPNPC_ ${_miniupnpc_header} HEADER_FOUND) - check_include_files(${_miniupnpc_header} ${HEADER_FOUND}) + # Prepend stddef.h: newer miniupnpc headers (2.3.x) reference size_t + # without including it, which would otherwise fail this self-compile + # check and wrongly mark miniupnpc as missing. + check_include_files("stddef.h;${_miniupnpc_header}" ${HEADER_FOUND}) if(NOT ${HEADER_FOUND}) set(MINIUPNPC_MISSING_HEADER ON) endif() diff --git a/src/compat/modern_prelude.h b/src/compat/modern_prelude.h new file mode 100644 index 000000000..bccd32dfd --- /dev/null +++ b/src/compat/modern_prelude.h @@ -0,0 +1,36 @@ +// Compatibility prelude force-included for all C++ TUs (see top-level +// CMAKE_CXX_FLAGS "-include"). Modern libstdc++ (GCC 13+) no longer pulls +// these in transitively the way the 2019-era code assumed. Including the +// common set here once avoids sprinkling includes across the tree (and +// avoids many slow rebuild cycles) just to build on a current toolchain. +#ifndef DEVAULT_COMPAT_MODERN_PRELUDE_H +#define DEVAULT_COMPAT_MODERN_PRELUDE_H + +// C library shims +#include +#include +#include +#include +#include +#include + +// Common utilities +#include +#include +#include +#include +#include +#include +#include + +// Common containers +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // DEVAULT_COMPAT_MODERN_PRELUDE_H diff --git a/src/net.cpp b/src/net.cpp index e6e2dea65..18e5599d3 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1420,7 +1420,13 @@ static void ThreadMapPort() { struct IGDdatas data; int r; +#if MINIUPNPC_API_VERSION >= 18 + char wanaddr[64]; + r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), + wanaddr, sizeof(wanaddr)); +#else r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); +#endif if (r == 1) { if (fDiscover) { char externalIPAddress[40]; diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp index 1c5271f8a..a19fee9e7 100644 --- a/src/support/lockedpool.cpp +++ b/src/support/lockedpool.cpp @@ -25,6 +25,7 @@ #endif #include +#include LockedPoolManager *LockedPoolManager::_instance = nullptr; std::once_flag LockedPoolManager::init_flag; diff --git a/src/validation.cpp b/src/validation.cpp index c2ddbf562..52861a617 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -54,7 +54,9 @@ #include // Temporary #include +#include #include +#include #include #include