[Gbbopen-list] Loading GBBopen open using asdf

Dan Corkill corkill at gbbopen.org
Sat Aug 11 15:18:20 EDT 2007


> Sorry to belabor the point, but I'm still having a little trouble -- but
> this might be due to not fully groking asdf.  I'm trying your third
> suggestion: Here is the file of the system I'm defining (in case the
> context is causing trouble):
> 
> (in-package :cl-user)
> 
> ;;;
> ---------------------------------------------------------------------------
> 
> (defpackage #:asdf-lbn-system (:use #:asdf #:cl))
> (in-package #:asdf-lbn-system)
> 
> ;;;
> ---------------------------------------------------------------------------
> 
> ;; Use jLinker
> (require :jlinker)
> 
> ;;;
> ---------------------------------------------------------------------------
> 
> (defsystem :lbn
>     :depends-on (:lbn-package :lbn-src))
> 
> (defsystem :lbn-package
>     :depends-on (:gbbopen)
>     :components
>     ((:system :gbbopen
>       :components ((:system :agenda-shell-user)))
>      (:module "dev"
>       :serial t
>       :components ((:file "package") (:file "logical-pathnames")))))
> 
> (defsystem :lbn-src
>     :depends-on (:lbn-package)
>     :components
>     ((:module "dev"
>       :serial t
>       :components ((:file "hello-java") ))))
> 
> My strategy here is to conceptually separate the package loading from
> the lbn source, but have a top-level :lbn system that I can call.  The
> lbn package uses gbbopen, so I want the gbbopen package to exist by the
> time I'm doing the package definition.  So I have made :lbn-package
> depend on :gbbopen, and as per your last example, added the :gbbopen
> system as a component (with the agenda-shell-user component) of
> :lbn-package.  But the agenda-shell-user system is not being loaded
> before the lbn package def, so the gbbopen package can't be used by the
> lbn package.

The short answer, is that I'd use the GBBopen mini-module system to
define your system (;-))!  The current problem with that approach is the
reverse direction (allowing ASDF systems to be used as mini-module
:requires) has not been done.

The bigger issue is that you are creating your packages too early.  A
philosophy that I recommend is to not have any activities (other than
loading/compiling files) performed by system-definition/building files
(whether you are using ASDF or mini-module or something else). In other
words, you should be able to get your system working if you manually
loaded the files in the same order as is done by the system tool.  Thus,
the package definition for :foo should be done in the first file of the
"system" that is loaded that needs to be in-package :foo:

(eval-when (:compile-toplevel :load-toplevel :execute)
  (unless (find-package :foo)
    (defpackage :foo ...)))

(in-package :foo)

This approach will have all the packages required by :foo already
established by the time the defpackage for :foo is executed.

Having things happen by side-effect via a system-definition facility is,
IMO, a really bad strategy.  That's one of the reasons that the
mini-module facility doesn't provide any compile or load time "forms"
associated with module definitions.

> I also tried your second suggestion and that works fine:
> 
> (in-package :cl-user)
> 
> (require :asdf)
> 
> (asdf:operate 'asdf:load-op :gbbopen)
> 
> (asdf:defsystem :mysys
>   :depends-on (:agenda-shell-user)
>   :components
>   ((:module "dev"
>     :serial t
>     :components ((:file "package")
> (:file "logical-pathnames")
> (:file "hello-java")))))
> 
> I can live with this because the first (asdf:operate 'asdf:load-op
> :gbbopen) only defines the gbbopen systems (via the mini-module).
> 
> I did, however, find one small issue with this latter approach: when
> compiling gbbopen on my system, the directory darwin-allegro-m-8.1/ is
> created in the GBBopen root directory and all of the fasls live under it
> (in respective subdirectories), but if I'm compiling gbbopen for the
> first time while loading :mysys, then I get the continuable error that
> the mini-module directory does not yet exist -- one of the continuations
> creates this and any other missing directories; once I select that
> continuation, everything completes and loads fine.

See *automatically-create-missing-directories* in
http://gbbopen.org/hyperdoc/ref-automatically-create-missing-directories.html
(the default is nil, meaning to generate the continuable error unless
the :create-dirs option is given to the mini-module command.

> Sorry if this is getting obtuse -- is what I'm doing non-standard? 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Gbbopen-list mailing list