ASDF: optimization settings and other enhancements



Hello,

is there an easy way to recompile a set of Lisp files with specific
optimization settings? For example, let's say I hit a bug in an ASDF packaged
library and don't get a useful backtrace since it's been compiled with minimal
debugging, so I'd like to recompile it with other optimization switches without
touching the source.

What I'd like to be able to do is something similar to the following:

(asdf:oos 'asdf:recompile-op :cl-foo-library
:optimize-speed 0 :optimize-debug 3)

which would recompile everything using (declare (optimize (speed 0) (debug 3))).

Currently the only way I know to change it requires putting a declaim line at
the top of each source file, which is messy. Since this sounds like a fairly
typical scenario I'm sure somebody has an elegant solution for this, but a bit
of googling didn't help me find it... I'll have a shot at hacking it into asdf
myself if there's no existing solution.

As a side note, isn't anyone else annoyed by the overly verbose syntax
for loading packages using asdf? I'm using the following macro:

(defmacro asdf::use (&rest pkgs)
`(eval-when (:compile-toplevel :load-toplevel :execute)
,@(loop for pkg in pkgs
collect `(asdf:oos 'asdf:load-op ,pkg))))

This way, (asdf::use :cl-ppcre :xmls) works interactively to load multiple
packages.

Or put this line at the top of a lisp file to make loading it "just work"
instead of needing special incantations, which is really nice for "#!"
executable Lisp files. (Yes, this was inspired by the Perl module facility...)

For example:

#!/usr/bin/clisp -C

(asdf:use :port)

(port:run-prog "/bin/ls")

This would require the following using plain ASDF:

#!/usr/bin/clisp -C

(eval-when (:compile-toplevel :load-toplevel :execute)
(asdf:oos 'asdf:load-op :port))

(port:run-prog "/bin/ls")

I'm sure this verbosity may be a factor why Lisp is less than popular as a
quick scripting solution...

-Klaus
.



Relevant Pages

  • Re: asdf : distributing C source files
    ... lisp files. ... to gcc) and is then loaded by SBCL. ... Can I package it using asdf? ...
    (comp.lang.lisp)
  • Re: Competed: Ali Babas Cave - The Roguelike
    ... The c-code compiles without error, but what am I supposed to do with ... the lisp files? ... ASDF is the Lisp analog of C makefiles. ... ridiculous hoops to install their software on daily basis, ...
    (rec.games.roguelike.development)
  • Re: ASDF problem (or maybe CL-GD but I dont think so)
    ... > I've been trying to test out CL-GD with CLISP 2.35 on Windows XP ... > required .lisp files so it must have to do the equivalent of 'cd' or ... > set a search directory for source before this can work. ... Here's a short explanation of what ASDF does, ...
    (comp.lang.lisp)
  • asdf : distributing C source files
    ... using SBCL which requires a C library apart from the lisp files. ... I was trying to see whether I can use asdf to package the whole thing. ... I have a C file which is to be compiled into a shared (.so using gcc. ...
    (comp.lang.lisp)