fix(guile-gnutls): make gnutls integration fully static by initializing from main guile binary

This commit is contained in:
vxtls 2026-03-05 10:55:38 -05:00
parent 9205c2b1e4
commit ac79f9e19d
6 changed files with 103 additions and 51 deletions

View file

@ -1,28 +0,0 @@
SPDX-License-Identifier: GPL-3.0-or-later
Keep the Guile extension model while avoiding a second libguile copy inside
the extension module.
When Guile itself is built without shared libguile, linking the extension
against libguile can embed another runtime copy and lead to crashes. Rely on
symbols from the hosting Guile process instead.
--- guile-gnutls-v5.0.1/guile/src/Makefile.am
+++ guile-gnutls-v5.0.1/guile/src/Makefile.am
@@ -40,14 +40,13 @@
# Use '-module' to build a "dlopenable module", in Libtool terms.
# Use '-undefined' to placate Libtool on Windows; see
# <https://lists.gnutls.org/pipermail/gnutls-devel/2014-December/007294.html>.
-guile_gnutls_v_2_la_LDFLAGS = -module -no-undefined
+guile_gnutls_v_2_la_LDFLAGS = -module
guile_gnutls_v_2_la_SOURCES = core.c errors.c utils.c
guile_gnutls_v_2_la_CFLAGS = \
$(AM_CFLAGS) $(GNULIB_CFLAGS) $(GUILE_CFLAGS) $(GNUTLS_CFLAGS)
guile_gnutls_v_2_la_LIBADD = \
- $(GNUTLS_LIBS) \
- $(GUILE_LDFLAGS)
+ $(GNUTLS_LIBS)
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/includes \

View file

@ -0,0 +1,22 @@
SPDX-License-Identifier: GPL-3.0-or-later
In static bootstrap profile, initialize bindings from symbols linked into the
main Guile executable rather than loading a shared extension object.
--- guile-gnutls-v5.0.1/guile/modules/gnutls.in
+++ guile-gnutls-v5.0.1/guile/modules/gnutls.in
@@ -817,11 +817,9 @@
;; save 'extensiondir' only if it's different from what Guile expects.
@maybe_guileextensiondir@))
- (unless (getenv "GNUTLS_GUILE_CROSS_COMPILING")
- (load-extension (if %libdir
- (string-append %libdir "/guile-gnutls-v-2")
- "guile-gnutls-v-2")
- "scm_init_gnutls")))
+ (unless (getenv "GNUTLS_GUILE_CROSS_COMPILING")
+ (dynamic-call "scm_init_gnutls"
+ (dynamic-link #f))))
(define-syntax define-deprecated
(lambda (s)