package/libsoup3: fix static build
PATCH 1/1 package/libsoup3: fix static build
From: Yegor Yefremov <[email protected]>
Since the bump to 3.7.3, libsoup unconditionally includes <dlfcn.h> in soup-init.c to detect whether libsoup2 is loaded in the same process. Static-only toolchains such as uClibc-ng without shared library support don't provide this header, so the build fails:
../libsoup/soup-init.c:21:10: fatal error: dlfcn.h: No such file or directory
Add a patch, submitted upstream, that checks for dlfcn.h at configure time and skips the libsoup2 detection when it is not available.
Fixes:
https://autobuild.buildroot.org/results/4effebe5fc12146749e704dd56f695363cc8fbc3
--- ...use-dlopen-when-dlfcn.h-is-available.patch | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 package/libsoup3/0001-soup-init-only-use-dlopen-when-dlfcn.h-is-available.patch
package/libsoup3/0001-soup-init-only-use-dlopen-when-dlfcn.h-is-available.patch new file +67 -0
@@ -0,0 +1,67 @@ +From 9dae8238db84a1ce2aeb61cce41af4718157172b Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov <[email protected]> +Date: Sun, 27 Sep 2026 12:03:53 +0200 +Subject: [PATCH] soup-init: only use dlopen() when dlfcn.h is available + +Commit 1296cbf983f0 ("soup-init: Use libdl instead of gmodule in +`soup2_is_loaded` check") unconditionally includes <dlfcn.h> on +non-Windows platforms. Static-only toolchains (e.g. uClibc-ng built +without shared library support) don't provide this header, so the +build fails: + +../libsoup/soup-init.c:21:10: fatal error: dlfcn.h: No such file or directory + +Check for dlfcn.h at configure time and skip the libsoup2 detection +when it is not available. Without dynamic loading, libsoup2 cannot be +loaded into the process at runtime anyway. + +Upstream: https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/571 +Signed-off-by: Yegor Yefremov <[email protected]> +Assisted-by: Claude:claude-opus-5 +--- + libsoup/soup-init.c | 9 ++++++--- + meson.build | 4 ++++ + 2 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/libsoup/soup-init.c b/libsoup/soup-init.c +index 3392e8e..a57db6e 100644 +--- a/libsoup/soup-init.c ++++ b/libsoup/soup-init.c +@@ -17,7 +17,7 @@ + #include <windows.h> + + HMODULE soup_dll; +-#else ++#elif defined (HAVE_DLFCN_H) + #include <dlfcn.h> + #endif + +@@ -26,8 +26,11 @@ soup2_is_loaded (void) + { + gboolean result = FALSE; + +- /* Skip on PE/COFF, as it doesn't have a flat symbol namespace */ +-#ifndef G_OS_WIN32 ++ /* Skip on PE/COFF, as it doesn't have a flat symbol namespace, ++ * and on platforms without dlopen() support (e.g. static-only ++ * toolchains). ++ */ ++#if !defined (G_OS_WIN32) && defined (HAVE_DLFCN_H) + gpointer handle; + gpointer func; + +diff --git a/meson.build b/meson.build +index 4422215..3140ceb 100644 +--- a/meson.build ++++ b/meson.build +@@ -167,6 +167,10 @@ libpsl_required_version = '>= 0.20' + libpsl_dep = dependency('libpsl', version : libpsl_required_version, + fallback : ['libpsl', 'libpsl_dep']) + ++if cc.has_header('dlfcn.h') ++ cdata.set('HAVE_DLFCN_H', '1') ++endif ++ + if cc.has_function('gmtime_r', prefix : '#include <time.h>', args : default_source_flag) + cdata.set('HAVE_GMTIME_R', '1') + endif
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni via buildroot
AppliedQuoted 9 lines · Yegor Yefremov via buildroot
From: Yegor Yefremov <[email protected]>
Since the bump to 3.7.3, libsoup unconditionally includes <
dlfcn.h> insoup-init.cto detect whether libsoup2 is loaded in the same process. Static-only toolchains such as uClibc-ng without shared library support don't provide this header, so the build fails:
../libsoup/soup-init.c:21:10: fatal error:dlfcn.h: No such file or directory
Quoted 8 lines
Add a patch, submitted upstream, that checks for
dlfcn.hat configure time and skips the libsoup2 detection when it is not available.Fixes:
https://autobuild.buildroot.org/results/4effebe5fc12146749e704dd56f695363cc8fbc3Signed-off-by Yegor Yefremov <[email protected]>Assisted-by Claude:claude-opus-5
It would be even better to explicitly mention the commit that introduced the regression, so I've added a Fixes: tag with this information.
Applied to master, thanks!
Best regards,
Thomas Petazzoni
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot