summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-11-07 22:26:54 +0100
committerMarius Bakke <marius@gnu.org>2022-12-02 14:58:26 +0100
commit047425a662608f56ba530052e21106028c5d6eeb (patch)
tree6caca9c954c8db39d0d3021e40fbfa352b540d9c
parent883fefe1605499c8d98426f2915816dddd7448ef (diff)
downloadguix-047425a662608f56ba530052e21106028c5d6eeb.tar.gz
syscalls: Adjust for lack of 'libutil.so' on glibc >= 2.34.
This is a re-implementation of 3c8b6fd94ceb1e898216929e8768fb518dbf1de9
done in a way that works for both glibc >= 2.34 and earlier versions.

* guix/build/syscalls.scm (syscall->procedure): When LIBRARY is true,
fall back to global symbols if (dynamic-link library) fails.

(cherry picked from commit 3f6c32a88fc7a4d707ae1ed8ef3f7bd995461aff)
-rw-r--r--guix/build/syscalls.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 2a12567b15..0358960ff5 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -447,9 +447,14 @@ If an error occurs while creating the binding, defer the error report until
 the returned procedure is called."
   (catch #t
     (lambda ()
+      ;; Note: When #:library is set, try it first and fall back to libc
+      ;; proper.  This is because libraries like libutil.so have been subsumed
+      ;; by libc.so with glibc >= 2.34.
       (let ((ptr (dynamic-func name
                                (if library
-                                   (dynamic-link library)
+                                   (or (false-if-exception
+                                        (dynamic-link library))
+                                       (dynamic-link))
                                    (dynamic-link)))))
         ;; The #:return-errno? facility was introduced in Guile 2.0.12.
         (pointer->procedure return-type ptr argument-types