From 03e056edcd1a7f7197a29068c52fa33fce12f7d7 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 7 Mar 2020 01:12:32 +0000 Subject: [PATCH 1/2] depends: Patch libevent build to fix IPv6 -rpcbind on Windows libevent uses getaddrinfo when available, and falls back to gethostbyname Windows has both, but gethostbyname only supports IPv4 libevent fails to detect Windows's getaddrinfo due to not including the right headers This patches libevent's configure script to check it correctly --- depends/packages/libevent.mk | 2 ++ .../libevent/0001-fix-windows-getaddrinfo.patch | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 depends/patches/libevent/0001-fix-windows-getaddrinfo.patch diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index eb45e14f6fb..ffdd5764270 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -3,8 +3,10 @@ $(package)_version=2.1.11-stable $(package)_download_path=https://github.com/libevent/libevent/archive/ $(package)_file_name=release-$($(package)_version).tar.gz $(package)_sha256_hash=229393ab2bf0dc94694f21836846b424f3532585bac3468738b7bf752c03901e +$(package)_patches=0001-fix-windows-getaddrinfo.patch define $(package)_preprocess_cmds + patch -p1 < $($(package)_patch_dir)/0001-fix-windows-getaddrinfo.patch && \ ./autogen.sh endef diff --git a/depends/patches/libevent/0001-fix-windows-getaddrinfo.patch b/depends/patches/libevent/0001-fix-windows-getaddrinfo.patch new file mode 100644 index 00000000000..a98cd90bd58 --- /dev/null +++ b/depends/patches/libevent/0001-fix-windows-getaddrinfo.patch @@ -0,0 +1,15 @@ +diff -ur libevent-2.1.8-stable.orig/configure.ac libevent-2.1.8-stable/configure.ac +--- libevent-2.1.8-stable.orig/configure.ac 2017-01-29 17:51:00.000000000 +0000 ++++ libevent-2.1.8-stable/configure.ac 2020-03-07 01:11:16.311335005 +0000 +@@ -389,6 +389,10 @@ + #ifdef HAVE_NETDB_H + #include + #endif ++#ifdef _WIN32 ++#include ++#include ++#endif + ]], + [[ + getaddrinfo; +Only in libevent-2.1.8-stable: configure.ac~ From eb6b73540d1ee7ff5a6874dd0e35f9b30b68e3b8 Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 25 Jun 2020 10:25:23 +0800 Subject: [PATCH 2/2] build: pass _WIN32_WINNT=0x0601 when building libevent for Windows This enables of the use of AI_* definitions in the Windows headers, specifically AI_ADDRCONFIG, which fixes an issue with libevent and ipv6 on Windows. It also aligns with what we define in configure when building Core. --- depends/packages/libevent.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index ffdd5764270..1cd5a1749ac 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -10,12 +10,16 @@ define $(package)_preprocess_cmds ./autogen.sh endef +# When building for Windows, we set _WIN32_WINNT to target the same Windows +# version as we do in configure. 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=--disable-shared --disable-openssl --disable-libevent-regress --disable-samples $(package)_config_opts += --disable-dependency-tracking --enable-option-checking $(package)_config_opts_release=--disable-debug-mode $(package)_config_opts_linux=--with-pic $(package)_config_opts_android=--with-pic + $(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601 endef define $(package)_config_cmds