unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* cl-gsll fails to load
@ 2021-12-06  6:16 Foo Chuan Wei
  2021-12-07 12:27 ` Guillaume Le Vaillant
  0 siblings, 1 reply; 5+ messages in thread
From: Foo Chuan Wei @ 2021-12-06  6:16 UTC (permalink / raw)
  To: guix-devel; +Cc: cox.katherine.e

I am using Guix on Ubuntu 20.04, and SBCL 2.1.9 (installed using `guix
install sbcl`). I have installed cl-gsll (`guix install cl-gsll`), but
`(asdf:load-system :gsll)` fails. Why?

This is my ASDF configuration

--8<---------------cut here---------------start------------->8---
;;;; File: ~/.config/common-lisp/source-registry.conf.d/guix-asdf.conf
(:tree "~/.guix-profile/share/common-lisp/")
--8<---------------cut here---------------end--------------->8---

This is the error message when `(asdf:load-system :gsll)` fails:

--8<---------------cut here---------------start------------->8---
; pkg-config libffi --cflags
; ERROR: Couldn't execute "pkg-config": No such file or directory


; Attempting to continue anyway.
; gcc -o /home/fcw/.cache/common-lisp/sbcl-2.1.9-linux-x64/gnu/store/5c2r9qg7krpnsqiia34jf6s8w71vgqsf-cl-cffi-0.24.1/share/common-lisp/source/cl-cffi/libffi/libffi-types__grovel-tmpTASQCYAW.o -c -g -Wall -Wundef -Wsign-compare -Wpointer-arith -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wunused-parameter -fno-omit-frame-pointer -momit-leaf-frame-pointer -fPIC -I/gnu/store/5c2r9qg7krpnsqiia34jf6s8w71vgqsf-cl-cffi-0.24.1/share/common-lisp/source/cl-cffi/ /home/fcw/.cache/common-lisp/sbcl-2.1.9-linux-x64/gnu/store/5c2r9qg7krpnsqiia34jf6s8w71vgqsf-cl-cffi-0.24.1/share/common-lisp/source/cl-cffi/libffi/libffi-types__grovel.c
While evaluating the form starting at line 21, column 0
  of #P"/gnu/store/q27bpjg4pcm81j9ij66fhdpvlwx3jdcz-cl-gsll-0.0.0-1.1a8ada2/share/common-lisp/source/cl-gsll/gsll.asd":

debugger invoked on a ASDF/FIND-SYSTEM:LOAD-SYSTEM-DEFINITION-ERROR in thread #<THREAD "main thread" RUNNING {10018587C3}>: Error while trying to load definition for system gsll from pathname /gnu/store/q27bpjg4pcm81j9ij66fhdpvlwx3jdcz-cl-gsll-0.0.0-1.1a8ada2/share/common-lisp/source/cl-gsll/gsll.asd: Couldn't execute "gcc": No such file or directory

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY                        ] Retry #<PROCESS-OP > on #<GROVEL-FILE "cffi-libffi" "libffi" "libffi-types">.
  1: [ACCEPT                       ] Continue, treating #<PROCESS-OP > on #<GROVEL-FILE "cffi-libffi" "libffi" "libffi-types"> as having been successful.
  2: [RETRY                        ] Retry EVAL of current toplevel form.
  3: [CONTINUE                     ] Ignore error and continue loading file "/gnu/store/q27bpjg4pcm81j9ij66fhdpvlwx3jdcz-cl-gsll-0.0.0-1.1a8ada2/share/common-lisp/source/cl-gsll/gsll.asd".
  4: [ABORT                        ] Abort loading file "/gnu/store/q27bpjg4pcm81j9ij66fhdpvlwx3jdcz-cl-gsll-0.0.0-1.1a8ada2/share/common-lisp/source/cl-gsll/gsll.asd".
  5:                                 Retry #<DEFINE-OP > on #<UNDEFINED-SYSTEM "gsll">.
  6:                                 Continue, treating #<DEFINE-OP > on #<UNDEFINED-SYSTEM "gsll"> as having been successful.
  7:                                 Retry ASDF operation.
  8: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
  9:                                 Retry ASDF operation.
 10:                                 Retry ASDF operation after resetting the configuration.
 11:                                 Exit debugger, returning to top level.

((FLET "H0" :IN ASDF/ACTION:PERFORM) #<CFFI-GROVEL:GROVEL-ERROR "~a" {100B957A93}>)
; File has been modified since compilation:
;   SYS:CONTRIB;ASDF;ASDF.LISP.NEWEST
; Using form offset instead of character position.
   error finding frame source: invalid feature expression: "#.(UIOP/UTILITY:SYMBOL-TEST-TO-FEATURE-EXPRESSION (COMMON-LISP:QUOTE #:COMPILER-ERROR-CONTEXT-%SOURCE) (COMMON-LISP:QUOTE #:SB-C))"
   source: NIL
0]
--8<---------------cut here---------------end--------------->8---

The problem does not appear when using sbcl-gsll instead of cl-gsll.
How do I fix the problem when using cl-gsll? It seems to be missing some
kind of input or native-input.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cl-gsll fails to load
  2021-12-06  6:16 cl-gsll fails to load Foo Chuan Wei
@ 2021-12-07 12:27 ` Guillaume Le Vaillant
  2021-12-10  4:07   ` Foo Chuan Wei
  0 siblings, 1 reply; 5+ messages in thread
From: Guillaume Le Vaillant @ 2021-12-07 12:27 UTC (permalink / raw)
  To: Foo Chuan Wei; +Cc: guix-devel, cox.katherine.e

[-- Attachment #1: Type: text/plain, Size: 4765 bytes --]

Foo Chuan Wei <chuanwei.foo@hotmail.com> skribis:

> I am using Guix on Ubuntu 20.04, and SBCL 2.1.9 (installed using `guix
> install sbcl`). I have installed cl-gsll (`guix install cl-gsll`), but
> `(asdf:load-system :gsll)` fails. Why?
>
> This is my ASDF configuration
>
> ;;;; File: ~/.config/common-lisp/source-registry.conf.d/guix-asdf.conf
> (:tree "~/.guix-profile/share/common-lisp/")
>
>
> This is the error message when `(asdf:load-system :gsll)` fails:
>
> ; pkg-config libffi --cflags
> ; ERROR: Couldn't execute "pkg-config": No such file or directory
>
>
> ; Attempting to continue anyway.
> ; gcc -o /home/fcw/.cache/common-lisp/sbcl-2.1.9-linux-x64/gnu/store/5c2r9qg7krpnsqiia34jf6s8w71vgqsf-cl-cffi-0.24.1/share/common-lisp/source/cl-cffi/libffi/libffi-types__grovel-tmpTASQCYAW.o -c -g -Wall -Wundef -Wsign-compare -Wpointer-arith -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wunused-parameter -fno-omit-frame-pointer -momit-leaf-frame-pointer -fPIC -I/gnu/store/5c2r9qg7krpnsqiia34jf6s8w71vgqsf-cl-cffi-0.24.1/share/common-lisp/source/cl-cffi/ /home/fcw/.cache/common-lisp/sbcl-2.1.9-linux-x64/gnu/store/5c2r9qg7krpnsqiia34jf6s8w71vgqsf-cl-cffi-0.24.1/share/common-lisp/source/cl-cffi/libffi/libffi-types__grovel.c
> While evaluating the form starting at line 21, column 0
>   of #P"/gnu/store/q27bpjg4pcm81j9ij66fhdpvlwx3jdcz-cl-gsll-0.0.0-1.1a8ada2/share/common-lisp/source/cl-gsll/gsll.asd":
>
> debugger invoked on a ASDF/FIND-SYSTEM:LOAD-SYSTEM-DEFINITION-ERROR in thread #<THREAD "main thread" RUNNING {10018587C3}>: Error while trying to load definition for system gsll from pathname /gnu/store/q27bpjg4pcm81j9ij66fhdpvlwx3jdcz-cl-gsll-0.0.0-1.1a8ada2/share/common-lisp/source/cl-gsll/gsll.asd: Couldn't execute "gcc": No such file or directory
>
> Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
>
> restarts (invokable by number or by possibly-abbreviated name):
>   0: [RETRY                        ] Retry #<PROCESS-OP > on #<GROVEL-FILE "cffi-libffi" "libffi" "libffi-types">.
>   1: [ACCEPT                       ] Continue, treating #<PROCESS-OP > on #<GROVEL-FILE "cffi-libffi" "libffi" "libffi-types"> as having been successful.
>   2: [RETRY                        ] Retry EVAL of current toplevel form.
>   3: [CONTINUE                     ] Ignore error and continue loading file "/gnu/store/q27bpjg4pcm81j9ij66fhdpvlwx3jdcz-cl-gsll-0.0.0-1.1a8ada2/share/common-lisp/source/cl-gsll/gsll.asd".
>   4: [ABORT                        ] Abort loading file "/gnu/store/q27bpjg4pcm81j9ij66fhdpvlwx3jdcz-cl-gsll-0.0.0-1.1a8ada2/share/common-lisp/source/cl-gsll/gsll.asd".
>   5:                                 Retry #<DEFINE-OP > on #<UNDEFINED-SYSTEM "gsll">.
>   6:                                 Continue, treating #<DEFINE-OP > on #<UNDEFINED-SYSTEM "gsll"> as having been successful.
>   7:                                 Retry ASDF operation.
>   8: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
>   9:                                 Retry ASDF operation.
>  10:                                 Retry ASDF operation after resetting the configuration.
>  11:                                 Exit debugger, returning to top level.
>
> ((FLET "H0" :IN ASDF/ACTION:PERFORM) #<CFFI-GROVEL:GROVEL-ERROR "~a" {100B957A93}>)
> ; File has been modified since compilation:
> ;   SYS:CONTRIB;ASDF;ASDF.LISP.NEWEST
> ; Using form offset instead of character position.
>    error finding frame source: invalid feature expression: "#.(UIOP/UTILITY:SYMBOL-TEST-TO-FEATURE-EXPRESSION (COMMON-LISP:QUOTE #:COMPILER-ERROR-CONTEXT-%SOURCE) (COMMON-LISP:QUOTE #:SB-C))"
>    source: NIL
> 0]
>
> The problem does not appear when using sbcl-gsll instead of cl-gsll.
> How do I fix the problem when using cl-gsll? It seems to be missing some
> kind of input or native-input.

I think the problem comes from the fact that the build system for
cl-xxx packages doesn't use the custom phases added to some sbcl-xxx
packages (like the 'fix-cffi-paths' phase of sbcl-gsll). Instead a fixed
set of phases is used (see '%standard-phases/source' from
"guix/build/asdf-build-system.scm", used in the
'sbcl-package->cl-source-package' function from
"guix/build-system/asdf.scm").

Therefore cl-xxx packages usually contain upstream version of the code,
without Guix-specific fixes, and having the dependencies installed in
a traditional/FHS way is necessary to compile the code.
For example the following seems to work:

--8<---------------cut here---------------start------------->8---
guix shell -C sbcl cl-gsll gcc-toolchain libffi gsl -- sbcl --eval '(require :asdf)' --eval '(asdf:load-system "gsll")'
--8<---------------cut here---------------end--------------->8---

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cl-gsll fails to load
  2021-12-07 12:27 ` Guillaume Le Vaillant
@ 2021-12-10  4:07   ` Foo Chuan Wei
  2021-12-10 13:41     ` Guillaume Le Vaillant
  0 siblings, 1 reply; 5+ messages in thread
From: Foo Chuan Wei @ 2021-12-10  4:07 UTC (permalink / raw)
  To: Guillaume Le Vaillant; +Cc: guix-devel, cox.katherine.e

On 2021-12-07 12:27 +0000, Guillaume Le Vaillant wrote:
> I think the problem comes from the fact that the build system for
> cl-xxx packages doesn't use the custom phases added to some sbcl-xxx
> packages (like the 'fix-cffi-paths' phase of sbcl-gsll). Instead a fixed
> set of phases is used (see '%standard-phases/source' from
> "guix/build/asdf-build-system.scm", used in the
> 'sbcl-package->cl-source-package' function from
> "guix/build-system/asdf.scm").

Are you sure about this? From my observations, the cl-xxx packages do
use the custom phases added to the sbcl-xxx packages. When I install
cl-gsll and look into its store directory
(~/.guix-profile/share/common-lisp/source/cl-gsll/), I do see the
effect of sbcl-gsll's custom phase ("fix-cffi-paths").


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cl-gsll fails to load
  2021-12-10  4:07   ` Foo Chuan Wei
@ 2021-12-10 13:41     ` Guillaume Le Vaillant
  2021-12-10 15:27       ` Guillaume Le Vaillant
  0 siblings, 1 reply; 5+ messages in thread
From: Guillaume Le Vaillant @ 2021-12-10 13:41 UTC (permalink / raw)
  To: Foo Chuan Wei; +Cc: guix-devel, cox.katherine.e

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

Foo Chuan Wei <chuanwei.foo@hotmail.com> skribis:

> On 2021-12-07 12:27 +0000, Guillaume Le Vaillant wrote:
>> I think the problem comes from the fact that the build system for
>> cl-xxx packages doesn't use the custom phases added to some sbcl-xxx
>> packages (like the 'fix-cffi-paths' phase of sbcl-gsll). Instead a fixed
>> set of phases is used (see '%standard-phases/source' from
>> "guix/build/asdf-build-system.scm", used in the
>> 'sbcl-package->cl-source-package' function from
>> "guix/build-system/asdf.scm").
>
> Are you sure about this? From my observations, the cl-xxx packages do
> use the custom phases added to the sbcl-xxx packages. When I install
> cl-gsll and look into its store directory
> (~/.guix-profile/share/common-lisp/source/cl-gsll/), I do see the
> effect of sbcl-gsll's custom phase ("fix-cffi-paths").

Indeed, it looks like custom phases are taken into considerations now (I
don't remember when this got fixed).
However although cl-cffi has a custom phase to fix the path to gcc, it
still tries to run "gcc" instead of "/gnu/store.../gcc" when compiling
cl-gsll from a REPL. I'll try to find where this bare "gcc" comes from...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cl-gsll fails to load
  2021-12-10 13:41     ` Guillaume Le Vaillant
@ 2021-12-10 15:27       ` Guillaume Le Vaillant
  0 siblings, 0 replies; 5+ messages in thread
From: Guillaume Le Vaillant @ 2021-12-10 15:27 UTC (permalink / raw)
  To: Guillaume Le Vaillant; +Cc: guix-devel, Foo Chuan Wei


[-- Attachment #1.1: Type: text/plain, Size: 476 bytes --]

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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-cl-cffi-Fix-some-paths.patch --]
[-- Type: text/x-patch, Size: 2913 bytes --]

From 7613cc6c054bfc5dc66f657aeb2987a22c342b80 Mon Sep 17 00:00:00 2001
From: Guillaume Le Vaillant <glv@posteo.net>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-gnu-cl-gsll-Fix-more-paths.patch --]
[-- Type: text/x-patch, Size: 2387 bytes --]

From 8bdf4c2dac67a9f5baf0d0facef7bd8bef120e63 Mon Sep 17 00:00:00 2001
From: Guillaume Le Vaillant <glv@posteo.net>
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-10 15:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-06  6:16 cl-gsll fails to load Foo Chuan Wei
2021-12-07 12:27 ` Guillaume Le Vaillant
2021-12-10  4:07   ` Foo Chuan Wei
2021-12-10 13:41     ` Guillaume Le Vaillant
2021-12-10 15:27       ` Guillaume Le Vaillant

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).