Could you try the attached patches and see if things work for you with
a command such as:

--8<---------------cut here---------------start------------->8---
guix shell -C sbcl sbcl-gsll gcc-toolchain -- ...
--8<---------------cut here---------------end--------------->8---

There may be a way to patch our CFFI package to fix the links to all the
GCC toolchain things, which would allow us to remove gcc-toolchain in
the command above, but it will probably not be super easy.
From 7613cc6c054bfc5dc66f657aeb2987a22c342b80 Mon Sep 17 00:00:00 2001
From: Guillaume Le Vaillant <[email protected]>
Date: Fri, 10 Dec 2021 15:56:07 +0100
Subject: [PATCH 1/2] gnu: cl-cffi: Fix some paths.

CFFI can require pkg-config and a GCC toolchain at runtime.
This patch improves the use of the source cl-cffi package from a REPL, but
it's not perfect and using cl-cffi in an environment without explicitly adding
gcc-toolchain to it might not work.

* gnu/packages/lisp-xyz.scm (sbcl-cffi)[native-inputs]: Move pkg-config to ...
  [inputs]: .. here.
  [arguments]: Update 'fix-paths' phase.
---
 gnu/packages/lisp-xyz.scm | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index 635f8e48cb..9f06be28ee 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -2782,10 +2782,10 @@ (define-public sbcl-cffi
      `(("alexandria" ,sbcl-alexandria)
        ("babel" ,sbcl-babel)
        ("libffi" ,libffi)
+       ("pkg-config" ,pkg-config)
        ("trivial-features" ,sbcl-trivial-features)))
     (native-inputs
      `(("bordeaux-threads" ,sbcl-bordeaux-threads)
-       ("pkg-config" ,pkg-config)
        ("rt" ,sbcl-rt)))
     (arguments
      '(#:phases
@@ -2799,10 +2799,25 @@ (define-public sbcl-cffi
          (add-after 'unpack 'fix-paths
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "libffi/libffi.lisp"
-               (("libffi.so.7" all) (string-append
-                                     (assoc-ref inputs "libffi")
-                                     "/lib/" all)))
+               (("libffi.so.7" all)
+                (string-append (assoc-ref inputs "libffi") "/lib/" all)))
+             (substitute* "libffi/libffi-types.lisp"
+               (("\\(in-package #:cffi\\)" all)
+                (string-append all
+                               "\n #+linux (cc-flags \"-I"
+                               (assoc-ref inputs "libffi")
+                               "/include/\")")))
+             (substitute* "grovel/grovel.lisp"
+               (("\"pkg-config\"")
+                (string-append "\"" (assoc-ref inputs "pkg-config")
+                               "/bin/pkg-config\"")))
+             ;; Force use of (default-toolchain-parameters) which the fixed
+             ;; path to gcc.
              (substitute* "toolchain/c-toolchain.lisp"
+               (("\\(clisp-toolchain-parameters\\)") "nil")
+               (("\\(ecl-toolchain-parameters\\)") "nil")
+               (("\\(mkcl-toolchain-parameters\\)") "nil")
+               (("\\(sbcl-toolchain-parameters\\)") "nil")
                (("\"cc\"") (format #f "~S" (which "gcc"))))))
          (add-after 'build 'install-headers
            (lambda* (#:key outputs #:allow-other-keys)
-- 
2.34.0

From 8bdf4c2dac67a9f5baf0d0facef7bd8bef120e63 Mon Sep 17 00:00:00 2001
From: Guillaume Le Vaillant <[email protected]>
Date: Fri, 10 Dec 2021 16:22:26 +0100
Subject: [PATCH 2/2] gnu: cl-gsll: Fix more paths.

* gnu/packages/lisp-xyz.scm (sbcl-gsll)[arguments]: Update 'fix-cffi-paths'
  phase.
---
 gnu/packages/lisp-xyz.scm | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index 9f06be28ee..58d4b889f6 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -7989,11 +7989,28 @@ (define-public sbcl-gsll
                (substitute* "init/init.lisp"
                  (("libgslcblas.so" all)
                   (string-append
-                   (assoc-ref inputs "gsl") "/lib/" all)))
-               (substitute* "init/init.lisp"
+                   (assoc-ref inputs "gsl") "/lib/" all))
                  (("libgsl.so" all)
                   (string-append
-                   (assoc-ref inputs "gsl") "/lib/" all))))))))
+                   (assoc-ref inputs "gsl") "/lib/" all)))
+               (substitute* '("calculus/monte-carlo-structs.lisp"
+                              "data/array-structs.lisp"
+                              "eigensystems/eigen-struct.lisp"
+                              "init/callback-struct.lisp"
+                              "init/libgsl-unix.lisp"
+                              "ordinary-differential-equations/ode-struct.lisp"
+                              "physical-constants/cgsm.lisp"
+                              "physical-constants/mksa.lisp"
+                              "physical-constants/num.lisp"
+                              "series-struct.lisp"
+                              "solve-minimize-fit/solver-struct.lisp"
+                              "special-functions/sf-result.lisp"
+                              "test-unit/machine.lisp")
+                 (("\\(in-package :gsl\\)" all)
+                  (string-append all
+                                 "\n#+linux (cc-flags \"-I"
+                                 (assoc-ref inputs "gsl")
+                                 "/include/\")"))))))))
       (synopsis "GNU Scientific Library for Lisp")
       (description
        "The GNU Scientific Library for Lisp (GSLL) allows the use of the
-- 
2.34.0

Attachment: signature.asc
Description: PGP signature

Reply via email to