简体   繁体   中英

SBCL ASDF problem vs. CCL Re: Circular Ref?

This compiles fine on ccl, but fails with a circular ref. error on SBCL:

kp.asd:

(in-package :asdf)
(defsystem kp
  :components
  ((:module "utils"
            :components
            ((:file "utils")
             ))
   ))
(load-system :kp)

------------------------
utils.lisp:

(defpackage :utils)
(in-package :utils)

(defvar *kp-version-utime* (get-universal-time))

------------------------
Error reported by SBCL:

debugger invoked on a LOAD-SYSTEM-DEFINITION-ERROR in thread #<THREAD "main thread" RUNNING {10005E85B3}>: Error while trying to load definition for \
system kp from pathname /var/www/ai/insights/kp.asd: Circular dependency: ((#<DEFINE-OP > . #<SYSTEM "kp">) (#<LOAD-OP > . #<SYSTEM "kp">) (#<LOAD-OP\
 > . #<MODULE "kp" "utils">) (#<LOAD-OP > . #<CL-SOURCE-FILE "kp" "utils" "utils">) (#<PREPARE-OP > . #<CL-SOURCE-FILE "kp" "utils" "utils">) (#<PREP\
ARE-OP > . #<MODULE "kp" "utils">) (#<PREPARE-OP > . #<SYSTEM "kp">))

(It looks like your post is mostly code; please add some more details.)

(load-system :kp)

You should not have this in an ASDF declaration. Better not consider a system definition as a Lisp program, only as a declarative way of stating your dependencies.

If, during the declaration of the system, you also need to load another system, then that system becomes a dependency. What happens most likely is that SBCL consider the file as a whole when evaluating it, and while loading kp , you ask it to load kp , which is indeed a circular dependency. Maybe CCL silently consider the file already loaded, I don't know.

If you remove it, entering (ql:quickload :kp) in the REPL works perfectly fine. Also, the (in-package :asdf) is useless (and if provided, it should be asdf-user )

Your .asd is invalid and deserves to lose.

Do you have an old CCL with ASDF 3.2 or earlier? Then it fails to detect the bug in your .asd. ASDF 3.3 correctly detects circular dependencies in the loading of .asd files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM