4

I'm trying to learn how to use Common-Lisp's asdf, and I have the following code:

(asdf:defsystem example
    :serial t
    :components ((:file "first")
                 (:file "second")))

However, I keep getting the error:

Condition of type: SIMPLE-ERROR
Invalid relative pathname #P"first.lisp" for component ("example" "first")

I'm launching the repl in the same directory as these two Lisp files, but I don't understand why there is an error. What am I missing? I'm using ECL on Windows

jefftime
  • 442
  • 5
  • 14
  • Aside from storing the system definition in a file and then saying something like `(asdf:load-system "path/to/mysystem.asd")`, you can load a system which is defined in your Lisp session, as you are trying to do here, and the key part is to define `:pathname` to tell ASDF where to look for files. I posted what I was able to figure out in this answer: https://stackoverflow.com/a/74932862/871096 – Robert Dodier Dec 27 '22 at 19:02

1 Answers1

6

ASDF uses *load-pathname* or *load-truename* to resolve the full paths to the system's components. If you enter the (asdf:defsystem ...) form on the REPL, these variables are not set. Write the defsystem form into a file, then load it like (load "example.asd").

jlahd
  • 6,257
  • 1
  • 15
  • 21
  • Although it does work to write the system definition into a file, it's also possible to define it in the Lisp session. The key point is to supply `:pathname` to tell ASDF where to find the files. – Robert Dodier Dec 27 '22 at 19:03