Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

November 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Oct  Dec

Re-building stale FASL files after ACL upgrade

Saturday, November 6, 2004

I mentioned the availability of ACL 7.0 last month. For those of you who are upgrading, there is always the hassle of re-compiling fasl's from a previous release. However, just recently, I came across this solution on the ASDF CLiki page:

If you update your Lisp to a version that uses a different fasl-format you get a diskfull of stale fasls that ASDF will try to load in good faith, with predictable and unpleasant results.

The ugly brute force solution is to find and delete all the fasls -- but there are better ways. Add the following around-method to your .lisp-init, .sbclrc, or equivalent:
;;; If the fasl was stale, try to recompile and load (once). Since only SBCL
;;; has a separate condition for bogus fasls we retry on any old error
;;; on other lisps. Actually, Allegro has a similar condition, but it's 
;;; unexported.  Works nicely for the ACL7 upgrade, though.
(defmethod asdf:perform :around ((o asdf:load-op) (c asdf:cl-source-file))
  (handler-case (call-next-method o c)
    (#+sbcl sb-ext:invalid-fasl 
     #+allegro excl::file-incompatible-fasl-error
     #-(or sbcl allegro) error ()
     (asdf:perform (make-instance 'asdf:compile-op) c)
     (call-next-method))))
Since I use ASDF for all my projects, this went into my init file the moment I came across it! Does anyone know what the equivalents would be for CLISP and LispWorks?

emacs Copyright © 2005 by Bill Clementson