Skip to content

Commit 5af5e97

Browse files
committed
Merge bitcoin/bitcoin#32690: depends: fix multiprocess build on OpenBSD (apply capnp patch, correct SHA256SUM command)
8713e80 depends: fix SHA256SUM command on OpenBSD (use GNU mode output) (Sebastian Falbesoner) 2d93872 depends: add patch to fix capnp build on OpenBSD (Sebastian Falbesoner) Pull request description: This PR fixes the multiprocess depends build for OpenBSD by applying upstream patch capnproto/capnproto#2308 and switching the SHA256SUM command to output hash sums in the expected format (the default is BSD format [1], but we need GNU format [2], see commit message for details). Note that the hashing issue is only prevailing for packages defining the `$(package)_local_dir` variable (introduced in 5d105fb, part of #31741), where the following line of the `fetch_local_dir_sha256` function leads to the wrong output: https://github.com/bitcoin/bitcoin/blob/ae024137bda9fe189f4e7ccf26dbaffd44cbbeb6/depends/funcs.mk#L57 The first commit can be replaced with a simple capnp version bump once this is available in a release. Tested on OpenBSD 7.7 (x86_64) via ``` $ 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 ``` [1] example output: `SHA256 (/home/thestack/.vimrc) = 6ba69d100e8c5ca0488ded6293d4e5f740a6a5d5ace96cbcf0599c18d27389e4` [2] example output: `6ba69d100e8c5ca0488ded6293d4e5f740a6a5d5ace96cbcf0599c18d27389e4 /home/thestack/.vimrc` ACKs for top commit: Sjors: ACK 8713e80 hebasto: ACK 8713e80. fanquake: ACK 8713e80 Tree-SHA512: 178b8b41156e1f1eea101849110167d2636c3093b6a68c88a91a994f0750831aa02e415eb2793c522682c92cb3085de025300e0e2dee894e112dd7e1f495cc08
2 parents fed41b7 + 8713e80 commit 5af5e97

File tree

5 files changed

+151
-2
lines changed

5 files changed

+151
-2
lines changed

depends/builders/openbsd.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
build_openbsd_CC = clang
22
build_openbsd_CXX = clang++
33

4-
build_openbsd_SHA256SUM = sha256
4+
build_openbsd_SHA256SUM = sha256 -r
55
build_openbsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
66

77
build_openbsd_TAR = gtar

depends/packages/capnp.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ $(package)_download_file=$(native_$(package)_download_file)
55
$(package)_file_name=$(native_$(package)_file_name)
66
$(package)_sha256_hash=$(native_$(package)_sha256_hash)
77
$(package)_patches=abi_placement_new.patch
8+
$(package)_patches += fix_openbsd_build.patch
89

910
define $(package)_set_vars
1011
$(package)_config_opts := -DBUILD_TESTING=OFF
@@ -14,7 +15,8 @@ define $(package)_set_vars
1415
endef
1516

1617
define $(package)_preprocess_cmds
17-
patch -p2 < $($(package)_patch_dir)/abi_placement_new.patch
18+
patch -p2 < $($(package)_patch_dir)/abi_placement_new.patch && \
19+
patch -p2 < $($(package)_patch_dir)/fix_openbsd_build.patch
1820
endef
1921

2022
define $(package)_config_cmds

depends/packages/native_capnp.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ $(package)_download_path=https://capnproto.org/
44
$(package)_download_file=capnproto-c++-$($(package)_version).tar.gz
55
$(package)_file_name=capnproto-cxx-$($(package)_version).tar.gz
66
$(package)_sha256_hash=07167580e563f5e821e3b2af1c238c16ec7181612650c5901330fa9a0da50939
7+
$(package)_patches=fix_openbsd_build.patch
78

89
define $(package)_set_vars
910
$(package)_config_opts := -DBUILD_TESTING=OFF
1011
$(package)_config_opts += -DWITH_OPENSSL=OFF
1112
$(package)_config_opts += -DWITH_ZLIB=OFF
1213
endef
1314

15+
define $(package)_preprocess_cmds
16+
patch -p2 < $($(package)_patch_dir)/fix_openbsd_build.patch
17+
endef
18+
1419
define $(package)_config_cmds
1520
$($(package)_cmake) .
1621
endef
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
From 0cd1792332dce6a3afae6e2bc2939da69fea65fa Mon Sep 17 00:00:00 2001
2+
From: Sebastian Falbesoner <[email protected]>
3+
Date: Sat, 31 May 2025 00:49:44 +0200
4+
Subject: [PATCH 1/2] In cidr.c++, include <netinet/in.h> on all non-Windows
5+
systems
6+
7+
The motivation for this commit is to fix the build for OpenBSD,
8+
but it may also solves the same potential problem for other systems
9+
without causing any harm.
10+
11+
Suggested already twice, see
12+
https://github.com/capnproto/capnproto/pull/1846#discussion_r1399499535
13+
https://github.com/capnproto/capnproto/pull/1907#discussion_r1452602424
14+
---
15+
c++/src/kj/cidr.c++ | 3 ---
16+
1 file changed, 3 deletions(-)
17+
18+
diff --git a/c++/src/kj/cidr.c++ b/c++/src/kj/cidr.c++
19+
index 6a1fa32e..9432b8f4 100644
20+
--- a/c++/src/kj/cidr.c++
21+
+++ b/c++/src/kj/cidr.c++
22+
@@ -39,9 +39,6 @@
23+
#else
24+
#include <sys/socket.h>
25+
#include <arpa/inet.h>
26+
-#endif
27+
-
28+
-#if __FreeBSD__
29+
#include <netinet/in.h>
30+
#endif
31+
32+
--
33+
2.49.0
34+
35+
36+
From 2e76d17db3fc484061487c0779b16495939d30c3 Mon Sep 17 00:00:00 2001
37+
From: Sebastian Falbesoner <[email protected]>
38+
Date: Sat, 31 May 2025 01:06:42 +0200
39+
Subject: [PATCH 2/2] Don't set KJ_USE_KQUEUE on OpenBSD
40+
41+
OpenBSD doesn't support user event filters yet, hence
42+
the build fails as it misses the symbol EVFILT_USER in
43+
the kqueue implementation in async-unix.c++. Fix that
44+
by not setting KJ_USE_KQUEUE on OpenBSD, so the poll()-
45+
based implementation is used instead.
46+
47+
Suggested in
48+
https://github.com/capnproto/capnproto/pull/1907/commits/829d3f03735f8f6762a50fc346db56bf02140f02#r1452600300
49+
---
50+
c++/src/kj/async-unix.h | 5 +++--
51+
1 file changed, 3 insertions(+), 2 deletions(-)
52+
53+
diff --git a/c++/src/kj/async-unix.h b/c++/src/kj/async-unix.h
54+
index 665305ea..e66ad8e4 100644
55+
--- a/c++/src/kj/async-unix.h
56+
+++ b/c++/src/kj/async-unix.h
57+
@@ -37,8 +37,9 @@ KJ_BEGIN_HEADER
58+
#if __linux__
59+
// Default to epoll on Linux.
60+
#define KJ_USE_EPOLL 1
61+
-#elif __APPLE__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__
62+
-// MacOS and BSDs prefer kqueue() for event notification.
63+
+#elif __APPLE__ || __FreeBSD__ || __NetBSD__ || __DragonFly__
64+
+// MacOS and most BSDs prefer kqueue() for event notification.
65+
+// (Note that OpenBSD's kqueue(2) doesn't support user event filters yet)
66+
#define KJ_USE_KQUEUE 1
67+
#endif
68+
#endif
69+
--
70+
2.49.0
71+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
From 0cd1792332dce6a3afae6e2bc2939da69fea65fa Mon Sep 17 00:00:00 2001
2+
From: Sebastian Falbesoner <[email protected]>
3+
Date: Sat, 31 May 2025 00:49:44 +0200
4+
Subject: [PATCH 1/2] In cidr.c++, include <netinet/in.h> on all non-Windows
5+
systems
6+
7+
The motivation for this commit is to fix the build for OpenBSD,
8+
but it may also solves the same potential problem for other systems
9+
without causing any harm.
10+
11+
Suggested already twice, see
12+
https://github.com/capnproto/capnproto/pull/1846#discussion_r1399499535
13+
https://github.com/capnproto/capnproto/pull/1907#discussion_r1452602424
14+
---
15+
c++/src/kj/cidr.c++ | 3 ---
16+
1 file changed, 3 deletions(-)
17+
18+
diff --git a/c++/src/kj/cidr.c++ b/c++/src/kj/cidr.c++
19+
index 6a1fa32e..9432b8f4 100644
20+
--- a/c++/src/kj/cidr.c++
21+
+++ b/c++/src/kj/cidr.c++
22+
@@ -39,9 +39,6 @@
23+
#else
24+
#include <sys/socket.h>
25+
#include <arpa/inet.h>
26+
-#endif
27+
-
28+
-#if __FreeBSD__
29+
#include <netinet/in.h>
30+
#endif
31+
32+
--
33+
2.49.0
34+
35+
36+
From 2e76d17db3fc484061487c0779b16495939d30c3 Mon Sep 17 00:00:00 2001
37+
From: Sebastian Falbesoner <[email protected]>
38+
Date: Sat, 31 May 2025 01:06:42 +0200
39+
Subject: [PATCH 2/2] Don't set KJ_USE_KQUEUE on OpenBSD
40+
41+
OpenBSD doesn't support user event filters yet, hence
42+
the build fails as it misses the symbol EVFILT_USER in
43+
the kqueue implementation in async-unix.c++. Fix that
44+
by not setting KJ_USE_KQUEUE on OpenBSD, so the poll()-
45+
based implementation is used instead.
46+
47+
Suggested in
48+
https://github.com/capnproto/capnproto/pull/1907/commits/829d3f03735f8f6762a50fc346db56bf02140f02#r1452600300
49+
---
50+
c++/src/kj/async-unix.h | 5 +++--
51+
1 file changed, 3 insertions(+), 2 deletions(-)
52+
53+
diff --git a/c++/src/kj/async-unix.h b/c++/src/kj/async-unix.h
54+
index 665305ea..e66ad8e4 100644
55+
--- a/c++/src/kj/async-unix.h
56+
+++ b/c++/src/kj/async-unix.h
57+
@@ -37,8 +37,9 @@ KJ_BEGIN_HEADER
58+
#if __linux__
59+
// Default to epoll on Linux.
60+
#define KJ_USE_EPOLL 1
61+
-#elif __APPLE__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__
62+
-// MacOS and BSDs prefer kqueue() for event notification.
63+
+#elif __APPLE__ || __FreeBSD__ || __NetBSD__ || __DragonFly__
64+
+// MacOS and most BSDs prefer kqueue() for event notification.
65+
+// (Note that OpenBSD's kqueue(2) doesn't support user event filters yet)
66+
#define KJ_USE_KQUEUE 1
67+
#endif
68+
#endif
69+
--
70+
2.49.0
71+

0 commit comments

Comments
 (0)