From 2d938720bd67cf4259bcc934025e7af17f5b4b2b Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Fri, 6 Jun 2025 01:27:48 +0200 Subject: [PATCH 1/2] depends: add patch to fix capnp build on OpenBSD see https://github.com/capnproto/capnproto/pull/2308 --- depends/packages/capnp.mk | 4 +- depends/packages/native_capnp.mk | 5 ++ depends/patches/capnp/fix_openbsd_build.patch | 71 +++++++++++++++++++ .../native_capnp/fix_openbsd_build.patch | 71 +++++++++++++++++++ 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 depends/patches/capnp/fix_openbsd_build.patch create mode 100644 depends/patches/native_capnp/fix_openbsd_build.patch diff --git a/depends/packages/capnp.mk b/depends/packages/capnp.mk index f8c4406f3e2..b9e20fe156c 100644 --- a/depends/packages/capnp.mk +++ b/depends/packages/capnp.mk @@ -5,6 +5,7 @@ $(package)_download_file=$(native_$(package)_download_file) $(package)_file_name=$(native_$(package)_file_name) $(package)_sha256_hash=$(native_$(package)_sha256_hash) $(package)_patches=abi_placement_new.patch +$(package)_patches += fix_openbsd_build.patch define $(package)_set_vars $(package)_config_opts := -DBUILD_TESTING=OFF @@ -14,7 +15,8 @@ define $(package)_set_vars endef define $(package)_preprocess_cmds - patch -p2 < $($(package)_patch_dir)/abi_placement_new.patch + patch -p2 < $($(package)_patch_dir)/abi_placement_new.patch && \ + patch -p2 < $($(package)_patch_dir)/fix_openbsd_build.patch endef define $(package)_config_cmds diff --git a/depends/packages/native_capnp.mk b/depends/packages/native_capnp.mk index e67b103716f..c886d8e239d 100644 --- a/depends/packages/native_capnp.mk +++ b/depends/packages/native_capnp.mk @@ -4,6 +4,7 @@ $(package)_download_path=https://capnproto.org/ $(package)_download_file=capnproto-c++-$($(package)_version).tar.gz $(package)_file_name=capnproto-cxx-$($(package)_version).tar.gz $(package)_sha256_hash=07167580e563f5e821e3b2af1c238c16ec7181612650c5901330fa9a0da50939 +$(package)_patches=fix_openbsd_build.patch define $(package)_set_vars $(package)_config_opts := -DBUILD_TESTING=OFF @@ -11,6 +12,10 @@ define $(package)_set_vars $(package)_config_opts += -DWITH_ZLIB=OFF endef +define $(package)_preprocess_cmds + patch -p2 < $($(package)_patch_dir)/fix_openbsd_build.patch +endef + define $(package)_config_cmds $($(package)_cmake) . endef diff --git a/depends/patches/capnp/fix_openbsd_build.patch b/depends/patches/capnp/fix_openbsd_build.patch new file mode 100644 index 00000000000..eb143c61e4d --- /dev/null +++ b/depends/patches/capnp/fix_openbsd_build.patch @@ -0,0 +1,71 @@ +From 0cd1792332dce6a3afae6e2bc2939da69fea65fa Mon Sep 17 00:00:00 2001 +From: Sebastian Falbesoner +Date: Sat, 31 May 2025 00:49:44 +0200 +Subject: [PATCH 1/2] In cidr.c++, include on all non-Windows + systems + +The motivation for this commit is to fix the build for OpenBSD, +but it may also solves the same potential problem for other systems +without causing any harm. + +Suggested already twice, see +https://github.com/capnproto/capnproto/pull/1846#discussion_r1399499535 +https://github.com/capnproto/capnproto/pull/1907#discussion_r1452602424 +--- + c++/src/kj/cidr.c++ | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/c++/src/kj/cidr.c++ b/c++/src/kj/cidr.c++ +index 6a1fa32e..9432b8f4 100644 +--- a/c++/src/kj/cidr.c++ ++++ b/c++/src/kj/cidr.c++ +@@ -39,9 +39,6 @@ + #else + #include + #include +-#endif +- +-#if __FreeBSD__ + #include + #endif + +-- +2.49.0 + + +From 2e76d17db3fc484061487c0779b16495939d30c3 Mon Sep 17 00:00:00 2001 +From: Sebastian Falbesoner +Date: Sat, 31 May 2025 01:06:42 +0200 +Subject: [PATCH 2/2] Don't set KJ_USE_KQUEUE on OpenBSD + +OpenBSD doesn't support user event filters yet, hence +the build fails as it misses the symbol EVFILT_USER in +the kqueue implementation in async-unix.c++. Fix that +by not setting KJ_USE_KQUEUE on OpenBSD, so the poll()- +based implementation is used instead. + +Suggested in +https://github.com/capnproto/capnproto/pull/1907/commits/829d3f03735f8f6762a50fc346db56bf02140f02#r1452600300 +--- + c++/src/kj/async-unix.h | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/c++/src/kj/async-unix.h b/c++/src/kj/async-unix.h +index 665305ea..e66ad8e4 100644 +--- a/c++/src/kj/async-unix.h ++++ b/c++/src/kj/async-unix.h +@@ -37,8 +37,9 @@ KJ_BEGIN_HEADER + #if __linux__ + // Default to epoll on Linux. + #define KJ_USE_EPOLL 1 +-#elif __APPLE__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__ +-// MacOS and BSDs prefer kqueue() for event notification. ++#elif __APPLE__ || __FreeBSD__ || __NetBSD__ || __DragonFly__ ++// MacOS and most BSDs prefer kqueue() for event notification. ++// (Note that OpenBSD's kqueue(2) doesn't support user event filters yet) + #define KJ_USE_KQUEUE 1 + #endif + #endif +-- +2.49.0 + diff --git a/depends/patches/native_capnp/fix_openbsd_build.patch b/depends/patches/native_capnp/fix_openbsd_build.patch new file mode 100644 index 00000000000..eb143c61e4d --- /dev/null +++ b/depends/patches/native_capnp/fix_openbsd_build.patch @@ -0,0 +1,71 @@ +From 0cd1792332dce6a3afae6e2bc2939da69fea65fa Mon Sep 17 00:00:00 2001 +From: Sebastian Falbesoner +Date: Sat, 31 May 2025 00:49:44 +0200 +Subject: [PATCH 1/2] In cidr.c++, include on all non-Windows + systems + +The motivation for this commit is to fix the build for OpenBSD, +but it may also solves the same potential problem for other systems +without causing any harm. + +Suggested already twice, see +https://github.com/capnproto/capnproto/pull/1846#discussion_r1399499535 +https://github.com/capnproto/capnproto/pull/1907#discussion_r1452602424 +--- + c++/src/kj/cidr.c++ | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/c++/src/kj/cidr.c++ b/c++/src/kj/cidr.c++ +index 6a1fa32e..9432b8f4 100644 +--- a/c++/src/kj/cidr.c++ ++++ b/c++/src/kj/cidr.c++ +@@ -39,9 +39,6 @@ + #else + #include + #include +-#endif +- +-#if __FreeBSD__ + #include + #endif + +-- +2.49.0 + + +From 2e76d17db3fc484061487c0779b16495939d30c3 Mon Sep 17 00:00:00 2001 +From: Sebastian Falbesoner +Date: Sat, 31 May 2025 01:06:42 +0200 +Subject: [PATCH 2/2] Don't set KJ_USE_KQUEUE on OpenBSD + +OpenBSD doesn't support user event filters yet, hence +the build fails as it misses the symbol EVFILT_USER in +the kqueue implementation in async-unix.c++. Fix that +by not setting KJ_USE_KQUEUE on OpenBSD, so the poll()- +based implementation is used instead. + +Suggested in +https://github.com/capnproto/capnproto/pull/1907/commits/829d3f03735f8f6762a50fc346db56bf02140f02#r1452600300 +--- + c++/src/kj/async-unix.h | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/c++/src/kj/async-unix.h b/c++/src/kj/async-unix.h +index 665305ea..e66ad8e4 100644 +--- a/c++/src/kj/async-unix.h ++++ b/c++/src/kj/async-unix.h +@@ -37,8 +37,9 @@ KJ_BEGIN_HEADER + #if __linux__ + // Default to epoll on Linux. + #define KJ_USE_EPOLL 1 +-#elif __APPLE__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__ +-// MacOS and BSDs prefer kqueue() for event notification. ++#elif __APPLE__ || __FreeBSD__ || __NetBSD__ || __DragonFly__ ++// MacOS and most BSDs prefer kqueue() for event notification. ++// (Note that OpenBSD's kqueue(2) doesn't support user event filters yet) + #define KJ_USE_KQUEUE 1 + #endif + #endif +-- +2.49.0 + From 8713e8060d504f561fed705b4aa5af7b96c36e75 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Fri, 6 Jun 2025 01:48:41 +0200 Subject: [PATCH 2/2] depends: fix SHA256SUM command on OpenBSD (use GNU mode output) On OpenBSD, the `sha256` command by default outputs hashsums on files in "BSD" mode, looking like this: $ sha256 ~/.vimrc SHA256 (/home/thestack/.vimrc) = 6ba69d100e8c5ca0488ded6293d4e5f740a6a5d5ace96cbcf0599c18d27389e4 This is not compatible with our depends commands, which expect the hashes to be on the first column (to be extracted via `cut -d" " -f1`). Fix this by switching to GNU mode output, looking like this: $ sha256 -r ~/.vimrc 6ba69d100e8c5ca0488ded6293d4e5f740a6a5d5ace96cbcf0599c18d27389e4 /home/thestack/.vimrc Without this change, the multiprocess depends build fails with the following output: $ gmake -C depends MULTIPROCESS=1 NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_QR=1 NO_WALLET=1 NO_ZMQ=1 NO_USDT=1 [ ..... ] Extracting native_libmultiprocess... sha256: /home/thestack/bitcoin/depends/work/build/x86_64-unknown-openbsd7.7/native_libmultiprocess/-2bc902f4693/.src-ipc-libmultiprocess.tar.hash: no properly formatted checksum lines found gmake: *** [funcs.mk:342: /home/thestack/bitcoin/depends/work/build/x86_64-unknown-openbsd7.7/native_libmultiprocess/-2bc902f4693/.stamp_extracted] Error 1 --- depends/builders/openbsd.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/builders/openbsd.mk b/depends/builders/openbsd.mk index 9c94c4baae7..4b3214ae810 100644 --- a/depends/builders/openbsd.mk +++ b/depends/builders/openbsd.mk @@ -1,7 +1,7 @@ build_openbsd_CC = clang build_openbsd_CXX = clang++ -build_openbsd_SHA256SUM = sha256 +build_openbsd_SHA256SUM = sha256 -r build_openbsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o build_openbsd_TAR = gtar