asdf:defsystem complains about path, sometimes

Drew C me at
Wed Mar 1 16:25:51 UTC 2017


On Wed, Mar 1, 2017 at 8:00 AM, Mirko Vukovic <mirko.vukovic at>

> Hello,
> This is with asdf,
> Armed Bear Common Lisp 1.4.0
> Java 1.6.0_41 Sun Microsystems Inc.
> OpenJDK 64-Bit Server VM,
> Emacs & Slime
> The following example code from the ASDF manual

The manual,,  just
before the code, states :

<< Let’s look at a simple system. This is a complete file that should be
saved as hello-lisp.asd (in order that ASDF can find it when ordered to
operate on the system named "hello-lisp") >>

This is important, as without a pathname where the system definition
resides, how can it know where "packages.lisp" resides?

> (asdf:defsystem "hello-lisp"
>   :description "hello-lisp: a sample Lisp system."
>   :version "0.0.1"
>   :author "Joe User <joe at>"
>   :licence "Public Domain"
>   :depends-on ("optima.ppcre" "command-line-arguments")
>   :components ((:file "packages")
>                (:file "macros" :depends-on ("packages"))
>                (:file "hello" :depends-on ("macros"))))
> when executed via the ABCL command line gives a relative path error

Because it is looking for  #P"packages.lisp", but does not know where it

Have a look at

;; The defsystem macro calls this function to determine the pathname of a
system as follows:
    ;; 1. If the pathname argument is an pathname object (NOT a namestring),
    ;;    that is already an absolute pathname, return it.
    ;; 2. Otherwise, the directory containing the LOAD-PATHNAME
    ;;    is considered (as deduced from e.g. *LOAD-PATHNAME*), and
    ;;    if it is indeed available and an absolute pathname, then
    ;;    the PATHNAME argument is normalized to a relative pathname
    ;;    and merged into that DIRECTORY as per SUBPATHNAME.
    ;;    Note: avoid *COMPILE-FILE-PATHNAME* because the .asd is loaded as
    ;;    but may be from within the EVAL-WHEN of a file compilation.
    ;; If no absolute pathname was found, we return NIL.

>   Invalid relative pathname #P"packages.lisp" for component ("hello-lisp"
> "packages")
> Restarts:
>   0: RETRY                         Retry ASDF operation.
>   1: CLEAR-CONFIGURATION-AND-RETRY Retry ASDF operation after resetting
> the configuration.
>   2: TOP-LEVEL                     Return to top level.
> If that code is in a file, then the file compiles cleanly:

As it should. It now knows where the files are located, because you have it
in the .asd file which is LOAD'ed.

> CL-USER(6): (load (compile-file "test.asd"))
> ; Compiling /home/mv/projects/poi+excel/test.asd ...
> ; Wrote /home/mv/projects/poi+excel/test.abcl (0.021 seconds)
> T
> CL-USER(7):
> I am looking for confirmation of this and second opinions before taking up
> at the ASDF mailing list.

Confirmed, the second option is what should be used most of the time.
Othewrwise, the source location (:pathname) can be used to tell it where
the source code lies without it 'guessing'. Does that all make sense?


Drew Crampsie

> Thanks,
> Mirko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the armedbear-devel mailing list