Subject: Re: bug#78445: meson-build-system's 'shrink-runpath phase fails for guile go files

From: Ludovic Courtès <[email-masked]>
Date: Thu, 15 May 2025 22:59:24 +0200

Hi,

Dariqq <[email-masked]> writes:

> I have been experimenting with using meson to manage some guile
> projects instead of autotools.
>
> When I try to build it with guix it fails during 'shrink-runpath phase
> on .go files:
>
> error: in phase 'shrink-runpath': uncaught exception:
> wrong-type-arg "struct-vtable" "Wrong type argument in position ~A
> (expecting ~A): ~S" (1 "struct" #f) (#f)

[...]

>     634:9  2 (for-each #<procedure strip-runpath (file)> _)

This is because ‘strip-runpath’ expects FILE to contain a DT_RUNPATH
section.  Failing that, the ‘runpath’ variable at gremlin.scm:417 is #f
and the (dynamic-entry-type runpath) calls right below fails with a
wrong-type-arg error.

A solution would be to fix ‘strip-runpath’ (patch below), though that
involves a world rebuild.

Another solution is to arrange so that ‘meson-build-system’ does not
touch .go files for this package, for instance by skipping the
‘shrink-runpath’ phase.

HTH,
Ludo’.

diff --git a/guix/build/gremlin.scm b/guix/build/gremlin.scm
index 2a74d51dd9..ceb1c7bcf5 100644
--- a/guix/build/gremlin.scm
+++ b/guix/build/gremlin.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2018, 2020 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2015, 2018, 2020, 2025 Ludovic Courtès <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -417,10 +417,11 @@ (define (strip-runpath file)
              (runpath  (find (lambda (entry)
                                (= DT_RUNPATH (dynamic-entry-type entry)))
                              entries))
-             (old      (search-path->list
-                        (dynamic-entry-value runpath)))
-             (new      (minimal-runpath needed old)))
-        (unless (equal? old new)
+             (old      (and runpath
+                            (search-path->list
+                             (dynamic-entry-value runpath))))
+             (new      (and old (minimal-runpath needed old))))
+        (unless (and old new (equal? old new))
           (format (current-error-port)
                   "~a: stripping RUNPATH to ~s (removed ~s)~%"
                   file new