"Cannot infer a system " on C-c C-c in Emacs
phoe opened this issue · comments
When compiling a whole file in emacs Lisp mode/Slime with C-x C-k
, the compilation seems to progress, but when compiling a single overlord:import
expression with C-c C-c
, the following error is produced:
Execution of a form compiled with errors.
Form:
(OVERLORD/IMPL:IMPORT INSTALL-QUERIES
:FROM
"sql/install.sql"
:AS
:CL-YESQL/POSTMODERN
:BINDING
(#'INSTALL-DROP-TABLES #'INSTALL-DROP-TYPES))
Compile-time error:
(during macroexpansion of (OVERLORD/IMPL:IMPORT INSTALL-QUERIES
...))
Cannot infer a system for #<PACKAGE "GATEWAY/SQL">
More data that seems to be similar: when compiling the whole file with C-x C-k
, I get:
cd /home/phoe/quicklisp/local-projects/gateway/sql/
1 compiler notes:
install.lisp:8:1:
error:
(during macroexpansion of (OVERLORD/IMPL:IMPORT INSTALL-QUERIES
...))
The value
NIL
is not of type
PACKAGE
Compilation failed.
Stacktrace:
The value
NIL
is not of type
PACKAGE
[Condition of type TYPE-ERROR]
Restarts:
0: [USE-VALUE] Supply a value to use instead
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] abort thread (#<THREAD "worker" RUNNING {10067E7143}>)
Backtrace:
0: (SB-KERNEL:WITH-SIMPLE-CONDITION-RESTARTS ERROR NIL TYPE-ERROR :DATUM NIL :EXPECTED-TYPE PACKAGE)
1: (SERAPEUM::%REQUIRE-TYPE #<unavailable lambda list>)
2: (OVERLORD/IMPL::SUFFIX-PACKAGE NIL "-USER")
3: ((:METHOD OVERLORD/IMPL::PATTERN-INIT (OVERLORD/IMPL::FASL-LANG-PATTERN)) #<OVERLORD/IMPL::FASL-LANG-PATTERN {10068A76E3}>) [fast-method]
4: ((LAMBDA NIL :IN OVERLORD/IMPL::FIND-SAVED-TASK))
5: ((LAMBDA (OVERLORD/IMPL::TARGET OVERLORD/IMPL::THUNK OVERLORD/IMPL::DEPS) :IN OVERLORD/IMPL::BUILD-RECURSIVELY) #P"/home/phoe/.cache/overlord/v7/sbcl-1.3.14.debian-linux-x64/CL-YESQL%2FPOSTMODERN/home..
6: (OVERLORD/IMPL::BUILD-RECURSIVELY #P"/home/phoe/.cache/overlord/v7/sbcl-1.3.14.debian-linux-x64/CL-YESQL%2FPOSTMODERN/home/phoe/quicklisp/local-projects/gateway/sql/install.fasl")
7: (OVERLORD/IMPL:BUILD #<OVERLORD/IMPL::PATTERN-REF /home/phoe/quicklisp/local-projects/gateway/sql/install.sql -> /home/phoe/.cache/overlord/v7/sbcl-1.3.14.debian-linux-x64/CL-YESQL%2FPOSTMODERN/home/p..
8: (OVERLORD/IMPL::DEPENDS-ON/1 #<OVERLORD/IMPL::PATTERN-REF /home/phoe/quicklisp/local-projects/gateway/sql/install.sql -> /home/phoe/.cache/overlord/v7/sbcl-1.3.14.debian-linux-x64/CL-YESQL%2FPOSTMODER..
9: (OVERLORD/IMPL:DEPENDS-ON-ALL (#<OVERLORD/IMPL::PATTERN-REF /home/phoe/quicklisp/local-projects/gateway/sql/install.sql -> /home/phoe/.cache/overlord/v7/sbcl-1.3.14.debian-linux-x64/CL-YESQL%2FPOSTMOD..
10: ((LAMBDA NIL :IN OVERLORD/IMPL::FIND-SAVED-TASK))
11: ((LAMBDA (OVERLORD/IMPL::TARGET OVERLORD/IMPL::THUNK OVERLORD/IMPL::DEPS) :IN OVERLORD/IMPL::BUILD-RECURSIVELY) #P"/home/phoe/.cache/overlord/v7/sbcl-1.3.14.debian-linux-x64/CL-YESQL%2FPOSTMODERN/home..
12: (OVERLORD/IMPL::BUILD-RECURSIVELY #P"/home/phoe/.cache/overlord/v7/sbcl-1.3.14.debian-linux-x64/CL-YESQL%2FPOSTMODERN/home/phoe/quicklisp/local-projects/gateway/sql/install.static-exports")
13: (OVERLORD/IMPL:BUILD #<OVERLORD/IMPL::PATTERN-REF /home/phoe/quicklisp/local-projects/gateway/sql/install.sql -> /home/phoe/.cache/overlord/v7/sbcl-1.3.14.debian-linux-x64/CL-YESQL%2FPOSTMODERN/home/p..
14: (OVERLORD/IMPL::ENSURE-STATIC-EXPORTS :CL-YESQL/POSTMODERN #P"/home/phoe/quicklisp/local-projects/gateway/sql/install.sql")
15: (OVERLORD/MODULE:MODULE-STATIC-EXPORTS :CL-YESQL/POSTMODERN #P"/home/phoe/quicklisp/local-projects/gateway/sql/install.sql")
16: (OVERLORD/MODULE:MODULE-STATIC-EXPORTS/CACHE #<unavailable argument> #P"/home/phoe/quicklisp/local-projects/gateway/sql/install.sql")
17: (OVERLORD/IMPL::EXPAND-BINDING-SPEC :ALL-AS-FUNCTIONS #<unavailable argument> #<unavailable argument>)
18: ((FLET OVERLORD/IMPL::EXPAND :IN OVERLORD/IMPL::BINDINGS+VALUES) :ALL-AS-FUNCTIONS)
19: (OVERLORD/IMPL::BINDINGS+VALUES :ALL-AS-FUNCTIONS NIL :LANG :CL-YESQL/POSTMODERN :SOURCE #P"/home/phoe/quicklisp/local-projects/gateway/sql/install.sql" :PREFIX NIL)
20: (OVERLORD/IMPL::RESOLVE-IMPORT-SPEC :LANG :CL-YESQL/POSTMODERN :SOURCE "sql/install.sql" :BINDINGS :ALL-AS-FUNCTIONS :VALUES NIL :MODULE INSTALL-QUERIES :BASE NIL :ENV NIL :PREFIX NIL)
Locals:
#:.DEFAULTING-TEMP. = :CL-YESQL/POSTMODERN
#:.DEFAULTING-TEMP.#1 = "sql/install.sql"
#:.DEFAULTING-TEMP.#2 = :ALL-AS-FUNCTIONS
#:.DEFAULTING-TEMP.#3 = NIL
#:.DEFAULTING-TEMP.#4 = INSTALL-QUERIES
#:.DEFAULTING-TEMP.#5 = NIL
#:.DEFAULTING-TEMP.#6 = NIL
#:.DEFAULTING-TEMP.#7 = NIL
#:N-SUPPLIED-5547 = 0
21: ((MACRO-FUNCTION OVERLORD/IMPL:IMPORT) (OVERLORD/IMPL:IMPORT INSTALL-QUERIES :FROM "sql/install.sql" :AS :CL-YESQL/POSTMODERN ...) NIL)
22: ((FLET SB-IMPL::PERFORM-EXPANSION :IN MACROEXPAND-1) #<FUNCTION (MACRO-FUNCTION OVERLORD/IMPL:IMPORT) {22BAA90B}> NIL)
23: (SWANK-MACROSTEP::MACROEXPAND-1-IN-CONTEXT (OVERLORD/IMPL:IMPORT INSTALL-QUERIES :FROM "sql/install.sql" :AS :CL-YESQL/POSTMODERN ...) ("" ""))
24: (SWANK-MACROSTEP::MACRO-FORM-TYPE (OVERLORD/IMPL:IMPORT INSTALL-QUERIES :FROM "sql/install.sql" :AS :CL-YESQL/POSTMODERN ...) T ("" ""))
25: ((LAMBDA NIL :IN SWANK-MACROSTEP:MACRO-FORM-P))
26: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK-MACROSTEP:MACRO-FORM-P) {10068265DB}>)
27: (SWANK-MACROSTEP:MACRO-FORM-P "(overlord:import install-queries ..)
28: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK-MACROSTEP:MACRO-FORM-P "(overlord:import install-queries ..)
29: (EVAL (SWANK-MACROSTEP:MACRO-FORM-P "(overlord:import install-queries ..)
30: (SWANK:EVAL-FOR-EMACS (SWANK-MACROSTEP:MACRO-FORM-P "(overlord:import install-queries ..)
31: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
32: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {2288FC2B}>)
33: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/home/phoe/.emacs.d/elpa/slime-20170622.1604/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL :IN SWANK::SPAWN-WORKER-TH..
34: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {1005A296E3}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {1005A29773}>) (*TRACE-OUTPUT* . #2#) (*ERR..
35: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
36: ((FLET #:WITHOUT-INTERRUPTS-BODY-1139 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
37: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
38: ((FLET #:WITHOUT-INTERRUPTS-BODY-359 :IN SB-THREAD::CALL-WITH-MUTEX))
39: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {7FFFF49FED6B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THR..
40: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "worker" RUNNING {10067E7143}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {10067E70EB}> (#<SB-THREAD:THREAD "worker" RU..
41: ("foreign function: call_into_lisp")
42: ("foreign function: new_thread_trampoline")
Just to make sure: is the yesql/postmodern
system actually loaded? That is, does the cl-yesql/postmodern
package actually exist?
...it is not loaded on my machine, even after (ql:quickload :cl-yesql)
.
It's a separate system. You need to (ql:quickload :cl-yesql/postmodern)
.
Probably the documentation needs to be improved in this respect.
Got it. As for the documentation - I'd rather improve the code first.
You have :AS :CL-YESQL/POSTMODERN
inside the overlord:import
expression. Could Overlord be able to check if a given system is loaded during the import operation, and if not, produce a more helpful error message than "NIL is not a package"?
I've both updated the README and fixed Overlord to give a more helpful error message.
❤️
Sadly, I need to have this reopened!
This seems like an Overlord issue more than CL-YESQL one, but I already have a topic for this, so I'll reuse this one.
I got it to work from the REPL, but compiling this from a file gives me the exact same stacktrace:
(overlord:import my-queries
:from #.(asdf:system-relative-pathname :gateway "install/install.sql")
:as :cl-yesql/postmodern
:binding :all-as-functions)
Execution of a form compiled with errors.
Form:
(OVERLORD/IMPL:IMPORT MY-QUERIES
:FROM
#P"/home/phoe/quicklisp/local-projects/gateway/install/install.sql"
:AS
:CL-YESQL/POSTMODERN
:BINDING
:ALL-AS-FUNCTIONS)
Compile-time error:
(during macroexpansion of (OVERLORD/IMPL:IMPORT MY-QUERIES
...))
Cannot infer a system for #<PACKAGE "GATEWAY/INSTALL">
Working dir: #P"/home/phoe/"
[Condition of type SB-INT:COMPILED-PROGRAM-ERROR]
Restarts:
0: [ABORT] Abort compilation.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] abort thread (#<THREAD "worker" RUNNING {100425F693}>)
Backtrace:
0: (SB-FASL::LOAD-FASL-GROUP #S(SB-FASL::FASL-INPUT :STREAM #<SB-SYS:FD-STREAM for "file /tmp/filevfEbSy.fasl" {1004BDE8A3}> :TABLE #(7 ERROR #<PACKAGE "SB-INT"> SB-INT:COMPILED-PROGRAM-ERROR :MESSAGE #1..
1: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file /tmp/filevfEbSy.fasl" {1004BDE8A3}> NIL NIL)
2: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-SYS:FD-STREAM for "file /tmp/filevfEbSy.fasl" {1004BDE8A3}> T)
3: (LOAD #P"/tmp/filevfEbSy.fasl" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)
4: ((FLET SWANK/BACKEND:CALL-WITH-COMPILATION-HOOKS :IN "/home/phoe/quicklisp/dists/quicklisp/software/slime-v2.19/swank/sbcl.lisp") #<CLOSURE (LAMBDA NIL :IN SWANK/BACKEND:SWANK-COMPILE-STRING) {1004BDD..
5: ((FLET SWANK/BACKEND:SWANK-COMPILE-STRING :IN "/home/phoe/quicklisp/dists/quicklisp/software/slime-v2.19/swank/sbcl.lisp") "(overlord:import my-queries ..)
6: ((LAMBDA NIL :IN SWANK:COMPILE-STRING-FOR-EMACS))
7: ((LAMBDA NIL :IN SWANK::COLLECT-NOTES))
8: (SWANK::MEASURE-TIME-INTERVAL #<CLOSURE (LAMBDA NIL :IN SWANK::COLLECT-NOTES) {100426477B}>)
9: (SWANK::COLLECT-NOTES #<CLOSURE (LAMBDA NIL :IN SWANK:COMPILE-STRING-FOR-EMACS) {100426473B}>)
10: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK:COMPILE-STRING-FOR-EMACS) {10042646FB}>)
11: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:COMPILE-STRING-FOR-EMACS "(overlord:import my-queries ..)
12: (EVAL (SWANK:COMPILE-STRING-FOR-EMACS "(overlord:import my-queries ..)
13: (SWANK:EVAL-FOR-EMACS (SWANK:COMPILE-STRING-FOR-EMACS "(overlord:import my-queries ..)
14: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
15: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {2288FD0B}>)
16: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/home/phoe/quicklisp/dists/quicklisp/software/slime-v2.19/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL :IN SWANK::SP..
17: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {10089213E3}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {1008921473}>) (*TRACE-OUTPUT* . #2#) (*ERR..
18: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
19: ((FLET #:WITHOUT-INTERRUPTS-BODY-1139 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
20: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
21: ((FLET #:WITHOUT-INTERRUPTS-BODY-359 :IN SB-THREAD::CALL-WITH-MUTEX))
22: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {7FFFE795ED6B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THR..
23: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "worker" RUNNING {100425F693}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {100425F63B}> (#<SB-THREAD:THREAD "worker" RU..
24: ("foreign function: call_into_lisp")
25: ("foreign function: new_thread_trampoline")
It looks that I somehow need to tell Overlord that package GATEWAY/INSTALL
belongs to ASDF system GATEWAY
. How do I do it?
That's strange. I put the (overlord:import ...)
call inside a DEFUN and compiled the whole file. Works, which is good enough for me.
Even weirder - with a block like this:
(eval-when (:compile-toplevel :load-toplevel :execute)
(defun reload ()
(overlord:import my-queries
:from #.(asdf:system-relative-pathname :gateway "install/install.sql")
:as :cl-yesql/postmodern
:binding :all-as-functions))
(reload))
When I compile the whole file, everything works fine, but if I C-c C-c
the block itself, it errors.
There's a set-package-base
macro you can use when Overlord fails to infer the correct base.
Worked like a charm. Thanks! (Could you document it?)