mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-07-05 19:50:40 +02:00
Merge bitcoin/bitcoin#34411: Full Libevent removal
146b3adfaadoc: remove libevent (fanquake)96d7f55f1dvcpkg: remove libevent (fanquake)0443943dc0ci: remove libevent (fanquake)a0ca249f3fdepends: remove libevent (fanquake)35d2d06797cmake: remove libevent (fanquake) Pull request description: This builds on all the work done by fjahr and pinheadmz to fully remove libevent from the codebase. Closes #31194. ACKs for top commit: fjahr: ACK146b3adfaadergoegge: ACK146b3adfaapinheadmz: ACK146b3adfaasedited: ACK146b3adfaaTree-SHA512: ecd14be93d11603d7c373a41474a7df1734b48550b12cd37933b604860913a77d42ee08bc187610881bec239b0834c2486f8fe52299cd3315a57b79c2e95929d
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -96,7 +96,7 @@ jobs:
|
||||
git config user.name "CI"
|
||||
- run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install clang mold ccache build-essential cmake ninja-build pkgconf python3-zmq libevent-dev libboost-dev libsqlite3-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev capnproto libcapnp-dev -y
|
||||
sudo apt-get install clang mold ccache build-essential cmake ninja-build pkgconf python3-zmq libboost-dev libsqlite3-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev capnproto libcapnp-dev -y
|
||||
sudo pip3 install --break-system-packages pycapnp
|
||||
- name: Compile and run tests
|
||||
run: |
|
||||
@@ -159,7 +159,7 @@ jobs:
|
||||
run: |
|
||||
# A workaround for "The `brew link` step did not complete successfully" error.
|
||||
brew install --quiet python@3 || brew link --overwrite python@3
|
||||
brew install --quiet coreutils ninja pkgconf ccache boost libevent zeromq qt@6 qrencode capnp
|
||||
brew install --quiet coreutils ninja pkgconf ccache boost zeromq qt@6 qrencode capnp
|
||||
|
||||
- name: Set Ccache directory
|
||||
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
|
||||
|
||||
@@ -221,10 +221,6 @@ target_link_libraries(core_interface INTERFACE
|
||||
include(AddBoostIfNeeded)
|
||||
add_boost_if_needed()
|
||||
|
||||
if(BUILD_DAEMON OR BUILD_GUI OR BUILD_CLI OR BUILD_TESTS OR BUILD_BENCH OR BUILD_FUZZ_BINARY)
|
||||
find_package(Libevent 2.1.8 MODULE REQUIRED)
|
||||
endif()
|
||||
|
||||
if(ENABLE_WALLET)
|
||||
if(VCPKG_TARGET_TRIPLET)
|
||||
# Use of the `unofficial::` namespace is a vcpkg package manager convention.
|
||||
|
||||
@@ -20,7 +20,7 @@ fi
|
||||
|
||||
export CONTAINER_NAME=ci_native_asan
|
||||
export APT_LLVM_V="22"
|
||||
export PACKAGES="systemtap-sdt-dev clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev mold python3-zmq qt6-base-dev qt6-tools-dev qt6-l10n-tools libevent-dev libboost-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE} libcapnp-dev capnproto python3-pip"
|
||||
export PACKAGES="systemtap-sdt-dev clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev mold python3-zmq qt6-base-dev qt6-tools-dev qt6-l10n-tools libboost-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE} libcapnp-dev capnproto python3-pip"
|
||||
export PIP_PACKAGES="--break-system-packages pycapnp"
|
||||
export NO_DEPENDS=1
|
||||
export GOAL="install"
|
||||
|
||||
@@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04"
|
||||
export CONTAINER_NAME=ci_native_fuzz
|
||||
export APT_LLVM_V="22"
|
||||
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev libevent-dev libboost-dev libsqlite3-dev libcapnp-dev capnproto"
|
||||
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev libboost-dev libsqlite3-dev libcapnp-dev capnproto"
|
||||
export NO_DEPENDS=1
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
|
||||
@@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04"
|
||||
export CONTAINER_NAME=ci_native_fuzz_valgrind
|
||||
export PACKAGES="clang llvm libclang-rt-dev libevent-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto"
|
||||
export PACKAGES="clang llvm libclang-rt-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto"
|
||||
export NO_DEPENDS=1
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
|
||||
@@ -10,7 +10,7 @@ export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" # To build codegen, CMake
|
||||
export CONTAINER_NAME=ci_native_iwyu
|
||||
export IWYU_LLVM_V="22"
|
||||
export APT_LLVM_V="${IWYU_LLVM_V}"
|
||||
export PACKAGES="clang-${IWYU_LLVM_V} clang-format-${IWYU_LLVM_V} libclang-${IWYU_LLVM_V}-dev llvm-${IWYU_LLVM_V}-dev jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto"
|
||||
export PACKAGES="clang-${IWYU_LLVM_V} clang-format-${IWYU_LLVM_V} libclang-${IWYU_LLVM_V}-dev llvm-${IWYU_LLVM_V}-dev jq libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto"
|
||||
export NO_DEPENDS=1
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
|
||||
@@ -10,7 +10,7 @@ export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04"
|
||||
export CONTAINER_NAME=ci_native_tidy
|
||||
export TIDY_LLVM_V="22"
|
||||
export APT_LLVM_V="${TIDY_LLVM_V}"
|
||||
export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto"
|
||||
export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto"
|
||||
export NO_DEPENDS=1
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
|
||||
@@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04"
|
||||
export CONTAINER_NAME=ci_native_valgrind
|
||||
export PACKAGES="clang llvm libclang-rt-dev valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip"
|
||||
export PACKAGES="clang llvm libclang-rt-dev valgrind python3-zmq libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip"
|
||||
export PIP_PACKAGES="--break-system-packages pycapnp"
|
||||
export USE_VALGRIND=1
|
||||
export NO_DEPENDS=1
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#[=======================================================================[
|
||||
FindLibevent
|
||||
------------
|
||||
|
||||
Finds the Libevent headers and libraries.
|
||||
|
||||
This is a wrapper around find_package()/pkg_check_modules() commands that:
|
||||
- facilitates searching in various build environments
|
||||
- prints a standard log message
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
# Check whether evhttp_connection_get_peer expects const char**.
|
||||
# See https://github.com/libevent/libevent/commit/a18301a2bb160ff7c3ffaf5b7653c39ffe27b385
|
||||
function(check_evhttp_connection_get_peer target)
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${target})
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("
|
||||
#include <cstdint>
|
||||
#include <event2/http.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
evhttp_connection* conn = (evhttp_connection*)1;
|
||||
const char* host;
|
||||
uint16_t port;
|
||||
evhttp_connection_get_peer(conn, &host, &port);
|
||||
}
|
||||
" HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
|
||||
)
|
||||
cmake_pop_check_state()
|
||||
target_compile_definitions(${target} INTERFACE
|
||||
$<$<BOOL:${HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR}>:HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR>
|
||||
)
|
||||
endfunction()
|
||||
|
||||
set(_libevent_components core extra)
|
||||
if(NOT WIN32)
|
||||
list(APPEND _libevent_components pthreads)
|
||||
endif()
|
||||
|
||||
find_package(Libevent ${Libevent_FIND_VERSION} QUIET
|
||||
NO_MODULE
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(Libevent_FOUND)
|
||||
find_package(Libevent ${Libevent_FIND_VERSION} QUIET
|
||||
REQUIRED COMPONENTS ${_libevent_components}
|
||||
NO_MODULE
|
||||
)
|
||||
find_package_handle_standard_args(Libevent
|
||||
REQUIRED_VARS Libevent_DIR
|
||||
VERSION_VAR Libevent_VERSION
|
||||
)
|
||||
check_evhttp_connection_get_peer(libevent::extra)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
foreach(component IN LISTS _libevent_components)
|
||||
pkg_check_modules(libevent_${component}
|
||||
REQUIRED QUIET
|
||||
IMPORTED_TARGET GLOBAL
|
||||
libevent_${component}>=${Libevent_FIND_VERSION}
|
||||
)
|
||||
if(TARGET PkgConfig::libevent_${component} AND NOT TARGET libevent::${component})
|
||||
add_library(libevent::${component} ALIAS PkgConfig::libevent_${component})
|
||||
endif()
|
||||
endforeach()
|
||||
find_package_handle_standard_args(Libevent
|
||||
REQUIRED_VARS libevent_core_LIBRARY_DIRS
|
||||
VERSION_VAR libevent_core_VERSION
|
||||
)
|
||||
check_evhttp_connection_get_peer(PkgConfig::libevent_extra)
|
||||
endif()
|
||||
|
||||
unset(_libevent_components)
|
||||
|
||||
mark_as_advanced(Libevent_DIR)
|
||||
mark_as_advanced(_event_h)
|
||||
mark_as_advanced(_event_lib)
|
||||
@@ -35,7 +35,6 @@ WORK_PATH = $(BASEDIR)/work
|
||||
BASE_CACHE ?= $(BASEDIR)/built
|
||||
SDK_PATH ?= $(BASEDIR)/SDKs
|
||||
NO_BOOST ?=
|
||||
NO_LIBEVENT ?=
|
||||
NO_QT ?=
|
||||
NO_QR ?=
|
||||
NO_WALLET ?=
|
||||
@@ -154,8 +153,6 @@ $(host_arch)_$(host_os)_id:=$(shell env CC='$(host_CC)' C_STANDARD='$(C_STANDARD
|
||||
|
||||
boost_packages_$(NO_BOOST) = $(boost_packages)
|
||||
|
||||
libevent_packages_$(NO_LIBEVENT) = $(libevent_packages)
|
||||
|
||||
qrencode_packages_$(NO_QR) = $(qrencode_$(host_os)_packages)
|
||||
|
||||
qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) $(qrencode_packages_)
|
||||
@@ -167,7 +164,7 @@ zmq_packages_$(NO_ZMQ) = $(zmq_packages)
|
||||
ipc_packages_$(NO_IPC) = $(ipc_packages)
|
||||
usdt_packages_$(NO_USDT) = $(usdt_$(host_os)_packages)
|
||||
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(boost_packages_) $(libevent_packages_) $(qt_packages_) $(wallet_packages_) $(usdt_packages_)
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(boost_packages_) $(qt_packages_) $(wallet_packages_) $(usdt_packages_)
|
||||
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) $(qt_native_packages_)
|
||||
|
||||
ifneq ($(zmq_packages_),)
|
||||
|
||||
@@ -90,7 +90,6 @@ The following can be set when running make: `make FOO=bar`
|
||||
- `C_STANDARD`: Set the C standard version used. Defaults to `c11`.
|
||||
- `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++20`.
|
||||
- `NO_BOOST`: Don't download/build/cache Boost
|
||||
- `NO_LIBEVENT`: Don't download/build/cache Libevent
|
||||
- `NO_QT`: Don't download/build/cache Qt and its dependencies
|
||||
- `NO_QR`: Don't download/build/cache packages needed for enabling qrencode
|
||||
- `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package=libevent
|
||||
$(package)_version=2.1.12-stable
|
||||
$(package)_download_path=https://github.com/libevent/libevent/releases/download/release-$($(package)_version)/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
|
||||
$(package)_patches=cmake_fixups.patch
|
||||
$(package)_patches += netbsd_fixup.patch
|
||||
$(package)_patches += winver_fixup.patch
|
||||
$(package)_build_subdir=build
|
||||
|
||||
# When building for Windows, we set _WIN32_WINNT to target the same Windows
|
||||
# version as we do in releases. Due to quirks in libevents build system, this
|
||||
# is also required to enable support for ipv6. See #19375.
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=-DCMAKE_BUILD_TYPE=None -DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_OPENSSL=ON
|
||||
$(package)_config_opts+=-DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_REGRESS=ON
|
||||
$(package)_config_opts+=-DEVENT__DISABLE_TESTS=ON -DEVENT__LIBRARY_TYPE=STATIC
|
||||
$(package)_cflags += -fdebug-prefix-map=$($(package)_extract_dir)=/usr -fmacro-prefix-map=$($(package)_extract_dir)=/usr
|
||||
$(package)_cppflags += -D_GNU_SOURCE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
||||
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0A00
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \
|
||||
patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch && \
|
||||
patch -p1 < $($(package)_patch_dir)/winver_fixup.patch
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_cmake) -S .. -B .
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
rm -rf bin lib/pkgconfig && \
|
||||
rm include/ev*.h && \
|
||||
rm include/event2/*_compat.h && \
|
||||
rm lib/libevent.a
|
||||
endef
|
||||
@@ -2,8 +2,6 @@ packages:=
|
||||
|
||||
boost_packages = boost
|
||||
|
||||
libevent_packages = libevent
|
||||
|
||||
qrencode_linux_packages = qrencode
|
||||
qrencode_freebsd_packages = qrencode
|
||||
qrencode_darwin_packages = qrencode
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
cmake: set minimum version to 3.5
|
||||
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -19,7 +19,7 @@
|
||||
# start libevent.sln
|
||||
#
|
||||
|
||||
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
|
||||
if (POLICY CMP0054)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
@@ -1,23 +0,0 @@
|
||||
Improve portability on NetBSD
|
||||
|
||||
According to GCC documentation, "the various `-std` options disable
|
||||
certain keywords".
|
||||
This change adheres to GCC's recommendation by replacing the `typeof`
|
||||
keyword with its alternative, `__typeof__`.
|
||||
|
||||
See https://github.com/libevent/libevent/commit/1759485e9a59147a47a674f5132fcfe764e7748c.
|
||||
|
||||
|
||||
--- a/kqueue.c
|
||||
+++ b/kqueue.c
|
||||
@@ -52,8 +52,8 @@
|
||||
* intptr_t, whereas others define it as void*. There doesn't seem to be an
|
||||
* easy way to tell them apart via autoconf, so we need to use OS macros. */
|
||||
#if defined(__NetBSD__)
|
||||
-#define PTR_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(x))
|
||||
-#define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
|
||||
+#define PTR_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(x))
|
||||
+#define INT_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(intptr_t)(x))
|
||||
#elif defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
|
||||
#define PTR_TO_UDATA(x) ((intptr_t)(x))
|
||||
#define INT_TO_UDATA(x) ((intptr_t)(x))
|
||||
@@ -1,122 +0,0 @@
|
||||
Cherry-picked from a14ff91254f40cf36e0fee199e26fb11260fab49.
|
||||
|
||||
move _WIN32_WINNT defintions before first #include
|
||||
|
||||
_WIN32_WINNT and WIN32_LEAN_AND_MEAN need to be defined
|
||||
before the windows.h is included for the first time.
|
||||
Avoid the confusion of indirect #include by defining
|
||||
before any.
|
||||
|
||||
diff --git a/event_iocp.c b/event_iocp.c
|
||||
index 6b2a2e15..4955e426 100644
|
||||
--- a/event_iocp.c
|
||||
+++ b/event_iocp.c
|
||||
@@ -23,12 +23,14 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
-#include "evconfig-private.h"
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
/* Minimum required for InitializeCriticalSectionAndSpinCount */
|
||||
#define _WIN32_WINNT 0x0403
|
||||
#endif
|
||||
+
|
||||
+#include "evconfig-private.h"
|
||||
+
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
diff --git a/evthread_win32.c b/evthread_win32.c
|
||||
index 2ec80560..8647f72b 100644
|
||||
--- a/evthread_win32.c
|
||||
+++ b/evthread_win32.c
|
||||
@@ -23,18 +23,21 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
-#include "event2/event-config.h"
|
||||
-#include "evconfig-private.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef _WIN32_WINNT
|
||||
/* Minimum required for InitializeCriticalSectionAndSpinCount */
|
||||
#define _WIN32_WINNT 0x0403
|
||||
#endif
|
||||
-#include <winsock2.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
+#endif
|
||||
+
|
||||
+#include "event2/event-config.h"
|
||||
+#include "evconfig-private.h"
|
||||
+
|
||||
+#ifdef _WIN32
|
||||
+#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
-#undef WIN32_LEAN_AND_MEAN
|
||||
#include <sys/locking.h>
|
||||
#endif
|
||||
|
||||
diff --git a/evutil.c b/evutil.c
|
||||
index 9817f086..8537ffe8 100644
|
||||
--- a/evutil.c
|
||||
+++ b/evutil.c
|
||||
@@ -24,6 +24,14 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
+#ifdef _WIN32
|
||||
+#ifndef _WIN32_WINNT
|
||||
+/* For structs needed by GetAdaptersAddresses */
|
||||
+#define _WIN32_WINNT 0x0501
|
||||
+#endif
|
||||
+#define WIN32_LEAN_AND_MEAN
|
||||
+#endif
|
||||
+
|
||||
#include "event2/event-config.h"
|
||||
#include "evconfig-private.h"
|
||||
|
||||
@@ -31,15 +39,10 @@
|
||||
#include <winsock2.h>
|
||||
#include <winerror.h>
|
||||
#include <ws2tcpip.h>
|
||||
-#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
-#undef WIN32_LEAN_AND_MEAN
|
||||
#include <io.h>
|
||||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
-#undef _WIN32_WINNT
|
||||
-/* For structs needed by GetAdaptersAddresses */
|
||||
-#define _WIN32_WINNT 0x0501
|
||||
#include <iphlpapi.h>
|
||||
#include <netioapi.h>
|
||||
#endif
|
||||
diff --git a/listener.c b/listener.c
|
||||
index f5c00c9c..d1080e76 100644
|
||||
--- a/listener.c
|
||||
+++ b/listener.c
|
||||
@@ -24,16 +24,19 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
+#ifdef _WIN32
|
||||
+#ifndef _WIN32_WINNT
|
||||
+/* Minimum required for InitializeCriticalSectionAndSpinCount */
|
||||
+#define _WIN32_WINNT 0x0403
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
#include "event2/event-config.h"
|
||||
#include "evconfig-private.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
-#ifndef _WIN32_WINNT
|
||||
-/* Minimum required for InitializeCriticalSectionAndSpinCount */
|
||||
-#define _WIN32_WINNT 0x0403
|
||||
-#endif
|
||||
#include <winsock2.h>
|
||||
#include <winerror.h>
|
||||
#include <ws2tcpip.h>
|
||||
@@ -10,7 +10,7 @@ This guide describes how to build bitcoind, command-line utilities, and GUI on F
|
||||
Run the following as root to install the base dependencies for building.
|
||||
|
||||
```bash
|
||||
pkg install boost-libs cmake git libevent pkgconf
|
||||
pkg install boost-libs cmake git pkgconf
|
||||
```
|
||||
|
||||
SQLite is required for the wallet:
|
||||
|
||||
@@ -12,7 +12,7 @@ Install the required dependencies the usual way you [install software on NetBSD]
|
||||
The example commands below use `pkgin`.
|
||||
|
||||
```bash
|
||||
pkgin install git cmake pkg-config boost libevent
|
||||
pkgin install git cmake pkg-config boost
|
||||
```
|
||||
|
||||
NetBSD currently ships with an older version of `gcc` than is needed to build. You should upgrade your `gcc` and then pass this new version to the CMake configuration.
|
||||
|
||||
@@ -10,7 +10,7 @@ This guide describes how to build bitcoind, command-line utilities, and GUI on O
|
||||
Run the following as root to install the base dependencies for building.
|
||||
|
||||
```bash
|
||||
pkg_add git cmake boost libevent
|
||||
pkg_add git cmake boost
|
||||
```
|
||||
|
||||
SQLite is required for the wallet:
|
||||
|
||||
@@ -50,7 +50,7 @@ See [dependencies.md](dependencies.md) for a complete overview.
|
||||
To install, run the following from your terminal:
|
||||
|
||||
``` bash
|
||||
brew install cmake boost pkgconf libevent capnp
|
||||
brew install cmake boost pkgconf capnp
|
||||
```
|
||||
|
||||
#### Wallet Dependencies
|
||||
|
||||
@@ -46,10 +46,10 @@ for additional features in later columns are optional.
|
||||
|
||||
| Package manager | Required build dependencies | SQLite (wallet) | Cap'n Proto (IPC) | ZMQ | USDT | Qt and libqrencode (GUI) |
|
||||
| ----------------------- | --------------------------- | --------------- | ----------------- | --- | ---- | ------------------------ |
|
||||
| Debian / Ubuntu (`apt`) | `build-essential cmake pkgconf python3 libevent-dev libboost-dev` | `libsqlite3-dev` | `libcapnp-dev capnproto` | `libzmq3-dev` | `systemtap-sdt-dev` | `qt6-base-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools libgl-dev qt6-wayland libqrencode-dev` |
|
||||
| Fedora (`dnf`) | `gcc-c++ cmake make python3 libevent-devel boost-devel` | `sqlite-devel` | `capnproto capnproto-devel` | `zeromq-devel` | `systemtap-sdt-devel` | `qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland qrencode-devel` |
|
||||
| Alpine (`apk`) | `build-base cmake linux-headers pkgconf python3 libevent-dev boost-dev` | `sqlite-dev` | `capnproto capnproto-dev` | `zeromq-dev` | Not supported | `qt6-qtbase-dev qt6-qttools-dev libqrencode-dev` |
|
||||
| Arch (`pacman`) | `gcc make cmake pkgconf python libevent boost` | `sqlite` | `capnproto` | `zeromq` | `systemtap` | `qt6-base qt6-tools qt6-wayland qrencode` |
|
||||
| Debian / Ubuntu (`apt`) | `build-essential cmake pkgconf python3 libboost-dev` | `libsqlite3-dev` | `libcapnp-dev capnproto` | `libzmq3-dev` | `systemtap-sdt-dev` | `qt6-base-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools libgl-dev qt6-wayland libqrencode-dev` |
|
||||
| Fedora (`dnf`) | `gcc-c++ cmake make python3 boost-devel` | `sqlite-devel` | `capnproto capnproto-devel` | `zeromq-devel` | `systemtap-sdt-devel` | `qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland qrencode-devel` |
|
||||
| Alpine (`apk`) | `build-base cmake linux-headers pkgconf python3 boost-dev` | `sqlite-dev` | `capnproto capnproto-dev` | `zeromq-dev` | Not supported | `qt6-qtbase-dev qt6-qttools-dev libqrencode-dev` |
|
||||
| Arch (`pacman`) | `gcc make cmake pkgconf python boost` | `sqlite` | `capnproto` | `zeromq` | `systemtap` | `qt6-base qt6-tools qt6-wayland qrencode` |
|
||||
|
||||
For Debian "oldstable", or earlier Ubuntu LTS releases, you may need to pick a
|
||||
later compiler version, according to the [dependencies](/doc/dependencies.md)
|
||||
|
||||
@@ -23,7 +23,6 @@ Bitcoin Core requires one of the following compilers.
|
||||
| --- | --- | --- |
|
||||
| [Boost](../depends/packages/boost.mk) | [link](https://www.boost.org/users/download/) | [1.74.0](https://github.com/bitcoin/bitcoin/pull/34107) |
|
||||
| CMake | [link](https://cmake.org/) | [3.22](https://github.com/bitcoin/bitcoin/pull/30454) |
|
||||
| [libevent](../depends/packages/libevent.mk) | [link](https://github.com/libevent/libevent/releases) | [2.1.8](https://github.com/bitcoin/bitcoin/pull/24681) |
|
||||
|
||||
### Runtime
|
||||
|
||||
|
||||
@@ -290,9 +290,6 @@ target_link_libraries(bitcoin_node
|
||||
minisketch
|
||||
univalue
|
||||
Boost::headers
|
||||
$<TARGET_NAME_IF_EXISTS:libevent::core>
|
||||
$<TARGET_NAME_IF_EXISTS:libevent::extra>
|
||||
$<TARGET_NAME_IF_EXISTS:libevent::pthreads>
|
||||
$<TARGET_NAME_IF_EXISTS:USDT::headers>
|
||||
)
|
||||
if(WITH_EMBEDDED_ASMAP)
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) 2016-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_SUPPORT_EVENTS_H
|
||||
#define BITCOIN_SUPPORT_EVENTS_H
|
||||
|
||||
#include <ios>
|
||||
#include <memory>
|
||||
|
||||
#include <event2/event.h>
|
||||
#include <event2/http.h>
|
||||
|
||||
#define MAKE_RAII(type) \
|
||||
/* deleter */\
|
||||
struct type##_deleter {\
|
||||
void operator()(struct type* ob) {\
|
||||
type##_free(ob);\
|
||||
}\
|
||||
};\
|
||||
/* unique ptr typedef */\
|
||||
typedef std::unique_ptr<struct type, type##_deleter> raii_##type
|
||||
|
||||
MAKE_RAII(event_base);
|
||||
MAKE_RAII(event);
|
||||
MAKE_RAII(evhttp);
|
||||
|
||||
inline raii_event_base obtain_event_base() {
|
||||
auto result = raii_event_base(event_base_new());
|
||||
if (!result.get())
|
||||
throw std::runtime_error("cannot create event_base");
|
||||
return result;
|
||||
}
|
||||
|
||||
inline raii_event obtain_event(struct event_base* base, evutil_socket_t s, short events, event_callback_fn cb, void* arg) {
|
||||
return raii_event(event_new(base, s, events, cb, arg));
|
||||
}
|
||||
|
||||
inline raii_evhttp obtain_evhttp(struct event_base* base) {
|
||||
return raii_evhttp(evhttp_new(base));
|
||||
}
|
||||
|
||||
#endif // BITCOIN_SUPPORT_EVENTS_H
|
||||
@@ -82,7 +82,6 @@ add_executable(test_bitcoin
|
||||
prevector_tests.cpp
|
||||
private_broadcast_tests.cpp
|
||||
psbt_tests.cpp
|
||||
raii_event_tests.cpp
|
||||
random_tests.cpp
|
||||
rbf_tests.cpp
|
||||
rest_tests.cpp
|
||||
@@ -168,7 +167,6 @@ target_link_libraries(test_bitcoin
|
||||
minisketch
|
||||
secp256k1
|
||||
Boost::headers
|
||||
libevent::extra
|
||||
$<TARGET_NAME_IF_EXISTS:USDT::headers>
|
||||
)
|
||||
|
||||
|
||||
@@ -154,7 +154,6 @@ target_link_libraries(fuzz
|
||||
univalue
|
||||
secp256k1
|
||||
Boost::headers
|
||||
libevent::extra
|
||||
)
|
||||
|
||||
if(ENABLE_WALLET)
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
// Copyright (c) 2016-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <event2/event.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
|
||||
#include <support/events.h>
|
||||
|
||||
#include <test/util/setup_common.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)
|
||||
|
||||
#ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
|
||||
|
||||
static std::map<void*, short> tags;
|
||||
static std::map<void*, uint16_t> orders;
|
||||
static uint16_t tagSequence = 0;
|
||||
|
||||
static void* tag_malloc(size_t sz) {
|
||||
void* mem = malloc(sz);
|
||||
if (!mem) return mem;
|
||||
tags[mem]++;
|
||||
orders[mem] = tagSequence++;
|
||||
return mem;
|
||||
}
|
||||
|
||||
static void tag_free(void* mem) {
|
||||
tags[mem]--;
|
||||
orders[mem] = tagSequence++;
|
||||
free(mem);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(raii_event_creation)
|
||||
{
|
||||
event_set_mem_functions(tag_malloc, realloc, tag_free);
|
||||
|
||||
void* base_ptr = nullptr;
|
||||
{
|
||||
auto base = obtain_event_base();
|
||||
base_ptr = (void*)base.get();
|
||||
BOOST_CHECK(tags[base_ptr] == 1);
|
||||
}
|
||||
BOOST_CHECK(tags[base_ptr] == 0);
|
||||
|
||||
void* event_ptr = nullptr;
|
||||
{
|
||||
auto base = obtain_event_base();
|
||||
auto event = obtain_event(base.get(), -1, 0, nullptr, nullptr);
|
||||
|
||||
base_ptr = (void*)base.get();
|
||||
event_ptr = (void*)event.get();
|
||||
|
||||
BOOST_CHECK(tags[base_ptr] == 1);
|
||||
BOOST_CHECK(tags[event_ptr] == 1);
|
||||
}
|
||||
BOOST_CHECK(tags[base_ptr] == 0);
|
||||
BOOST_CHECK(tags[event_ptr] == 0);
|
||||
|
||||
event_set_mem_functions(malloc, realloc, free);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(raii_event_order)
|
||||
{
|
||||
event_set_mem_functions(tag_malloc, realloc, tag_free);
|
||||
|
||||
void* base_ptr = nullptr;
|
||||
void* event_ptr = nullptr;
|
||||
{
|
||||
auto base = obtain_event_base();
|
||||
auto event = obtain_event(base.get(), -1, 0, nullptr, nullptr);
|
||||
|
||||
base_ptr = (void*)base.get();
|
||||
event_ptr = (void*)event.get();
|
||||
|
||||
// base should have allocated before event
|
||||
BOOST_CHECK(orders[base_ptr] < orders[event_ptr]);
|
||||
}
|
||||
// base should be freed after event
|
||||
BOOST_CHECK(orders[base_ptr] > orders[event_ptr]);
|
||||
|
||||
event_set_mem_functions(malloc, realloc, free);
|
||||
}
|
||||
|
||||
#endif // EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
@@ -60,8 +60,8 @@ RPCMethod walletpassphrase()
|
||||
if (nSleepTime < 0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Timeout cannot be negative.");
|
||||
}
|
||||
// Clamp timeout
|
||||
constexpr int64_t MAX_SLEEP_TIME = 100000000; // larger values trigger a macos/libevent bug?
|
||||
// Clamp timeout to ~3 years to avoid overflow when computing the relock time
|
||||
constexpr int64_t MAX_SLEEP_TIME = 100000000;
|
||||
if (nSleepTime > MAX_SLEEP_TIME) {
|
||||
nSleepTime = MAX_SLEEP_TIME;
|
||||
}
|
||||
|
||||
12
vcpkg.json
12
vcpkg.json
@@ -3,8 +3,7 @@
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
|
||||
"builtin-baseline": "120deac3062162151622ca4860575a33844ba10b",
|
||||
"dependencies": [
|
||||
"boost-multi-index",
|
||||
"libevent"
|
||||
"boost-multi-index"
|
||||
],
|
||||
"default-features": [
|
||||
"qt",
|
||||
@@ -49,12 +48,5 @@
|
||||
"zeromq"
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"$comment": "Newer unreleased libevent versions cause https://github.com/bitcoin/bitcoin/issues/30096",
|
||||
"name": "libevent",
|
||||
"version": "2.1.12#7"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user