0

我目前正在 Common Lisp 中构建一个项目,并且正在使用 ASDF。但是,我遇到了一些困难。也就是说,当我运行时asdf:compile-system,它似乎可以编译。然后我就可以asdf:load-system成功了。但是,位于某些文件中的某些函数仍未定义。为了让他们知道,我必须手动导航到该文件并编译它。

这是系统的声明。有人可以告诉我我做错了什么吗?

(defsystem "xxx-xxxx"
  :version "0.1.0"
  :author ""
  :license ""
  :depends-on ("cl-mongo" "hunchentoot" "clack" "ningle" "cl-json" "hermetic" "lack-middleware-session" "cl-markup")
  :components ((:module "src"
                :components
                ((:file "packages")
         (:file "lisp-utils")
         (:file "xxx-xxxx" :depends-on ("packages"))
         (:file "database" :depends-on ("packages"))
         (:file "database-config" :depends-on ("packages"))
         (:file "server" :depends-on ("packages"))
         (:file "clack" :depends-on ("packages"))
         (:file "routes/activities" :depends-on ("packages"))
         (:file "route-processors" :depends-on ("packages")))))
  :description ""
  :long-description
  #.(read-file-string
     (subpathname *load-pathname* "README.markdown"))
  :in-order-to ((test-op (test-op "xxx-xxxx-test"))))

特别是,我对文件有问题,routes/activities可能route-processors.

4

1 回答 1

5

鉴于我对 asdf 的经验,您的系统定义中唯一的问题是“路线/活动”文件,因为子文件夹被定义为模块。该文件应该可以解决您的问题:

(defsystem "xxx-xxxx"
  :version "0.1.0"
  :author ""
  :license ""
  :depends-on ("cl-mongo" 
               "hunchentoot" 
               "clack" 
               "ningle" 
               "cl-json" 
               "hermetic" 
               "lack-middleware-session" 
               "cl-markup")
  :components ((:module "src"
                :components
                ((:file "packages")
                 (:file "lisp-utils")
                 (:file "xxx-xxxx" 
                        :depends-on ("packages"))
                 (:file "database" 
                        :depends-on ("packages"))
                 (:file "database-config" 
                        :depends-on ("packages"))
                 (:file "server" 
                        :depends-on ("packages"))
                 (:file "clack" 
                        :depends-on ("packages"))
                 (:module "routes"
                          :components ((:file "activities"))
                          :depends-on ("packages"))
                 (:file "route-processors" 
                        :depends-on ("packages")))))
  :description ""
  :long-description
  #.(read-file-string
     (subpathname *load-pathname* "README.markdown"))
  :in-order-to ((test-op (test-op "xxx-xxxx-test"))))

解决您的最后一条评论。异常的原因是依赖关系在依赖关系的父级所在的列表中解析。因此,如果您说“活动”依赖于“包”但模块中有“活动”,asdf 将搜索该模块中的包/subfolder 并且由于它不存在而找不到它。是否放肆无关紧要,这就是它的工作原理。这也是有意义的,因为模块通常描述一个逻辑连贯的单元,因此该单元的依赖关系应该是相似的,否则您可能需要重新考虑您的项目结构。

于 2018-03-29T14:36:00.067 回答