depends: Build `qt` and `qrencode` packages for OpenBSD hosts
What changed, and why it matters
This commit adds build-system support so that Bitcoin Core's graphical user interface (GUI) and QR-code library can be compiled on OpenBSD. It does not change how Bitcoin validates transactions or handles wallets; it only fixes compilation and packaging issues for a new operating-system target. There is no indication this introduces a security vulnerability.
No security action required; treat as normal build-system maintenance. Reviewers may verify the OpenBSD build succeeds and that the new patches do not break existing Linux/FreeBSD/macOS/Windows builds.
Security signals we found
No security-relevant code paths modified
No memory-unsafe changes
No cryptographic or consensus logic touched
Build-system porting only
Evidence from the diff
The change extends the depends build system to treat OpenBSD similarly to FreeBSD/Linux for Qt, qrencode, freetype, and XCB plugin dependencies. It adds OpenBSD-specific patches: (1) a freetype CMake versioning patch to align shared-library ABI naming with libtool; (2) a Qt network patch to include netinet6/in6_var.h and skip IFT_STF on OpenBSD; (3) a Qt ELF parser patch to avoid the undeclared ELFOSABI_AIX constant; and (4) CMake logic to import the XCB integration plugin on OpenBSD. All changes are build/porting fixes.
Changed components
depends build systemQt dependency build configurationfreetype dependency build configurationsrc/qt/CMakeLists.txt plugin importsInspect captured patch +101 / −5
diff --git a/depends/README.md b/depends/README.md
index b12df135..bdb92794 100644
--- a/depends/README.md
+++ b/depends/README.md
@@ -53,6 +53,10 @@ To build dependencies for the current arch+OS:
pkg_add bash cmake curl gmake gtar
+Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):
+
+ pkg_add bison ninja
+
To build dependencies for the current arch+OS:
gmake
diff --git a/depends/packages/freetype.mk b/depends/packages/freetype.mk
index b34edc60..74d5e42a 100644
--- a/depends/packages/freetype.mk
+++ b/depends/packages/freetype.mk
@@ -5,6 +5,7 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=f8db94d307e9c54961b39a1cc799a67d46681480696ed72ecf78d4473770f09b
$(package)_build_subdir=build
$(package)_patches += cmake_minimum.patch
+$(package)_patches += openbsd_versioning.patch
define $(package)_set_vars
$(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DBUILD_SHARED_LIBS=TRUE
@@ -14,7 +15,8 @@ define $(package)_set_vars
endef
define $(package)_preprocess_cmds
- patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch
+ patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch && \
+ patch -p1 < $($(package)_patch_dir)/openbsd_versioning.patch
endef
define $(package)_config_cmds
diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk
index 22ae4787..b77c3eca 100644
--- a/depends/packages/packages.mk
+++ b/depends/packages/packages.mk
@@ -6,11 +6,13 @@ libevent_packages = libevent
qrencode_linux_packages = qrencode
qrencode_freebsd_packages = qrencode
+qrencode_openbsd_packages = qrencode
qrencode_darwin_packages = qrencode
qrencode_mingw32_packages = qrencode
qt_linux_packages:=qt expat libxcb xcb_proto libXau xproto freetype fontconfig libxkbcommon libxcb_util libxcb_util_cursor libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm
qt_freebsd_packages:=$(qt_linux_packages)
+qt_openbsd_packages:=$(qt_linux_packages)
qt_darwin_packages=qt
qt_mingw32_packages=qt
ifneq ($(host),$(build))
diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk
index 9b7cec34..500a2729 100644
--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -9,6 +9,7 @@ $(package)_dependencies := native_$(package)
endif
$(package)_linux_dependencies := freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_cursor libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm
$(package)_freebsd_dependencies := $($(package)_linux_dependencies)
+$(package)_openbsd_dependencies := $($(package)_linux_dependencies)
$(package)_patches_path := $(qt_details_patches_path)
$(package)_patches := cocoa_compat.patch
$(package)_patches += dont_hardcode_pwd.patch
@@ -26,6 +27,8 @@ $(package)_patches += fix-gcc16-sfinae-qbitarray.patch
$(package)_patches += fix-gcc16-sfinae-qanystringview.patch
$(package)_patches += fix-macos26-qyield.patch
$(package)_patches += fix-qbytearray-include.patch
+$(package)_patches += fix_openbsd_network_kernel.patch
+$(package)_patches += fix_openbsd_plugin_qelfparser.patch
$(package)_qttranslations_file_name=$(qt_details_qttranslations_file_name)
$(package)_qttranslations_sha256_hash=$(qt_details_qttranslations_sha256_hash)
@@ -158,6 +161,7 @@ $(package)_config_opts_linux += -ltcg
endif
$(package)_config_opts_freebsd := $$($(package)_config_opts_linux)
$(package)_config_opts_freebsd += -no-feature-inotify
+$(package)_config_opts_openbsd := $$($(package)_config_opts_linux)
$(package)_config_opts_mingw32 := -no-dbus
$(package)_config_opts_mingw32 += -no-feature-freetype
@@ -208,7 +212,7 @@ $(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapSystemDoubleConversion
$(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapSystemMd4c=TRUE
$(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapZSTD=TRUE
endif
-ifeq ($(host_os),linux)
+ifneq (,$(filter linux openbsd,$(host_os)))
# The `-dbus-runtime` configure option does not work
# https://qt-project.atlassian.net/browse/QTBUG-144864
$(package)_cmake_opts += -DINPUT_dbus=runtime
@@ -284,7 +288,9 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qbitarray.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qanystringview.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-macos26-qyield.patch && \
- patch -p1 -i $($(package)_patch_dir)/fix-qbytearray-include.patch
+ patch -p1 -i $($(package)_patch_dir)/fix-qbytearray-include.patch && \
+ patch -p1 -i $($(package)_patch_dir)/fix_openbsd_network_kernel.patch && \
+ patch -p1 -i $($(package)_patch_dir)/fix_openbsd_plugin_qelfparser.patch
endef
ifeq ($(host),$(build))
$(package)_preprocess_cmds += && patch -p1 -i $($(package)_patch_dir)/qttools_skip_dependencies.patch
diff --git a/depends/patches/freetype/openbsd_versioning.patch b/depends/patches/freetype/openbsd_versioning.patch
new file mode 100644
index 00000000..ea5cffef
--- /dev/null
+++ b/depends/patches/freetype/openbsd_versioning.patch
@@ -0,0 +1,31 @@
+[cmake] Fix shared library versioning on OpenBSD.
+
+This emulates Libtool to make sure Libtool and CMake agree on the ABI
+version. Specifically, for OpenBSD, `builds/unix/configure` defines
+`version_type=sunos` and skips defining `soname_spec`.
+
+See upstream MR: https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/433.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -458,9 +458,17 @@ if (WIN32)
+ endif ()
+
+ if (BUILD_SHARED_LIBS)
+- set_target_properties(freetype PROPERTIES
+- VERSION ${LIBRARY_VERSION}
+- SOVERSION ${LIBRARY_SOVERSION})
++ if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
++ # For OpenBSD, libtool follows `sunos` version type.
++ set_target_properties(freetype PROPERTIES
++ # libtool does not define its internal `soname_spec` variable
++ # for OpenBSD. So skipping the SOVERSION option.
++ VERSION ${LIBTOOL_CURRENT}.${LIBTOOL_REVISION})
++ else ()
++ set_target_properties(freetype PROPERTIES
++ VERSION ${LIBRARY_VERSION}
++ SOVERSION ${LIBRARY_SOVERSION})
++ endif ()
+ endif ()
+
+ # Pick up ftconfig.h and ftoption.h generated above, first.
diff --git a/depends/patches/qt/fix_openbsd_network_kernel.patch b/depends/patches/qt/fix_openbsd_network_kernel.patch
new file mode 100644
index 00000000..2a5a4ac2
--- /dev/null
+++ b/depends/patches/qt/fix_openbsd_network_kernel.patch
@@ -0,0 +1,31 @@
+Fix compiling on OpenBSD
+
+1. The `net/if_types.h` header does not define the `IFT_STF` symbol.
+2. The `netinet6/in6_var.h` header defines some of the used symbols.
+
+For the reference, see:
+ - https://codeberg.org/OpenBSD/ports/src/commit/f8f1aedbe8aff550c69930b5d92b9c392e298382/x11/qt6/qtbase/patches/patch-src_network_kernel_qnetworkinterface_unix_cpp
+
+
+--- a/qtbase/src/network/kernel/qnetworkinterface_unix.cpp
++++ b/qtbase/src/network/kernel/qnetworkinterface_unix.cpp
+@@ -392,6 +392,9 @@ QT_BEGIN_INCLUDE_NAMESPACE
+ # include <net/if_media.h>
+ # include <net/if_types.h>
+ # include <netinet/in_var.h>
++# ifdef Q_OS_OPENBSD
++# include <netinet6/in6_var.h>
++# endif
+ #endif // QT_PLATFORM_UIKIT
+ QT_END_INCLUDE_NAMESPACE
+
+@@ -419,7 +422,9 @@ static QNetworkInterface::InterfaceType probeIfType(int socket, int iftype, stru
+ return QNetworkInterface::Ieee1394;
+
+ case IFT_GIF:
++#ifndef Q_OS_OPENBSD
+ case IFT_STF:
++#endif
+ return QNetworkInterface::Virtual;
+ }
+
diff --git a/depends/patches/qt/fix_openbsd_plugin_qelfparser.patch b/depends/patches/qt/fix_openbsd_plugin_qelfparser.patch
new file mode 100644
index 00000000..1b32e45f
--- /dev/null
+++ b/depends/patches/qt/fix_openbsd_plugin_qelfparser.patch
@@ -0,0 +1,20 @@
+Fix compiling on OpenBSD
+
+Avoid use of undeclared identifier `ELFOSABI_AIX`.
+
+For the reference, see:
+ - https://codeberg.org/OpenBSD/ports/src/commit/c5e4088b89277b96d840492f9961b1593182b99c/x11/qt6/qtbase/patches/patch-src_corelib_plugin_qelfparser_p_cpp
+
+
+--- a/qtbase/src/corelib/plugin/qelfparser_p.cpp
++++ b/qtbase/src/corelib/plugin/qelfparser_p.cpp
+@@ -341,7 +341,9 @@ Q_DECL_UNUSED Q_DECL_COLD_FUNCTION static QDebug &operator<<(QDebug &d, ElfHeade
+ case ELFOSABI_NETBSD: d << " (NetBSD"; break;
+ case ELFOSABI_LINUX: d << " (GNU/Linux"; break;
+ case ELFOSABI_SOLARIS: d << " (Solaris"; break;
++#ifndef Q_OS_OPENBSD
+ case ELFOSABI_AIX: d << " (AIX"; break;
++#endif
+ case ELFOSABI_IRIX: d << " (IRIX"; break;
+ case ELFOSABI_FREEBSD: d << " (FreeBSD"; break;
+ case ELFOSABI_OPENBSD: d << " (OpenBSD"; break;
diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in
index 87189efa..9d9f9e49 100644
--- a/depends/toolchain.cmake.in
+++ b/depends/toolchain.cmake.in
@@ -117,7 +117,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE)
endif()
-if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|FreeBSD)$")
+if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|FreeBSD|OpenBSD)$")
# Customize pkg-config behavior for finding dependencies
# of the xcb QPA platform plugin:
# 1. Restrict search paths to the depends.
diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt
index 58fa08b5..b5ad93dc 100644
--- a/src/qt/CMakeLists.txt
+++ b/src/qt/CMakeLists.txt
@@ -16,7 +16,7 @@ get_target_property(qt_lib_type Qt6::Core TYPE)
function(import_plugins target)
if(qt_lib_type STREQUAL "STATIC_LIBRARY")
set(plugins Qt6::QMinimalIntegrationPlugin)
- if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|FreeBSD)$")
+ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|FreeBSD|OpenBSD)$")
list(APPEND plugins Qt6::QXcbIntegrationPlugin)
elseif(WIN32)
list(APPEND plugins Qt6::QWindowsIntegrationPlugin Qt6::QModernWindowsStylePlugin)
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.