[Openmcl-devel] cl-glfw

Gary Byers gb at clozure.com
Sun Dec 26 22:54:07 UTC 2010


The code that you're having trouble with may assume that the
compile-time processing of the DEFCONSTANT forms makes those
definitions available globally and pervasively, so that they can be
referenced in code that's subsequently executed during compilation of
the file.

Section 3.2.3.1.1 of the spec notes that this is a non-portable
assumption, and notes that portable code should surround the 
defining macro with an EVAL-WHEN that includes :COMPILE-TOPLEVEL
as well as other applicable situations.

CCL generally tries to limit the compile-time side-effects of
defining macros (DEFMACRO, DEFCONSTANT, ...) to the compilation
environment (so that the macro/constant definitions are visible
when subsequent forms in the file are compiled but not generally
visible to arbitrary functions that're called at compile-time.)
If it's desirable make the definitions globally available - so
that arbitrary functions called during compilation (like LISPIFY-KEY)
can see those definitions, it's trivial to use EVAL-WHEN to arrange
that.



On Sun, 26 Dec 2010, James Ashley wrote:

> I'm not sure where the actual problem lies here. I don't really know
> enough about asdf (much less asdf-install) to even really begin
> debugging it.
>
> I just tried (quickload "cl-glfw"), using CCL and ubuntu (10.4, I
> think...whatever the previous "long-term support" version was).
>
> After dealing with a "glfw is not installed" error (by installing it
> using apt-get), I got
>
> a
>
> Unbound variable: CL-GLFW:+KEY-BACKSPACE+
>   [Condition of type UNBOUND-VARIABLE]
>
> restart in the debugger.
>
> The nutshell version seems to be that something's calling (lispify-key
> ...) which calls (key-int-to-symbol ...), before the constants defined
> earlier in the file have been entered into the symbol table.
>
> I can (load #P"whatever") the file manually without any problems.
>
> So there seems to be some sort of weird interaction between read and
> compile times...which I'm really not fluent enough to begin to debug.
> I don't have a clue whether this is a problem with quicklisp, asdf, or
> ccl. For all I know, it's a bug in slime. (I don't think it is....I
> get the same error in the standard command-line version, and I can fix
> it by defining the constants in the debugger. It just moves on to the
> next symbol in the list and complains that it isn't defined).
>
> Can anyone point me in a direction that gives me more clues about how
> I can solve this problem?
>
> The stack trace doesn't look very interesting to me, but here it is, anyway:
>
> Backtrace:
>  0: (CCL::%DEFAULT-UNBOUND-VARIABLE-RESTARTS 17460012753734
> CL-GLFW:+KEY-BACKSPACE+)
>  1: (CL-GLFW::KEY-INT-TO-SYMBOL #<Unknown Arguments>)
>  2: (FUNCALL #<Compiled-function CL-GLFW::KEY-INT-TO-SYMBOL
> (Non-Global)  #x302001362E5F> (CL-GLFW::KEY-INT-TO-SYMBOL
> CL-GLFW::KEY-INT) #<CCL::LEXICAL-ENVIRONMENT #x3020013A476D>)
>  3: (MACROEXPAND-1 (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT)
> #<CCL::LEXICAL-ENVIRONMENT #x3020012F8C0D>)
>  4: (CCL::NX-TRANSFORM (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT)
> #<CCL::LEXICAL-ENVIRONMENT #x3020012F8C0D> #<HASH-TABLE :TEST EQ size
> 1368/1549 #x3020012562BD>)
>  5: (CCL::NX1-TYPED-FORM (CL-GLFW::KEY-INT-TO-SYMBOL
> CL-GLFW::KEY-INT) #<CCL::LEXICAL-ENVIRONMENT #x3020012F8C0D>)
>  6: (CCL::NX1-FORM (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT)
> #<CCL::LEXICAL-ENVIRONMENT #x3020012F8C0D>)
>  7: (CCL::NX1-IF (IF (AND (>= CL-GLFW::KEY-INT 0) (< CL-GLFW::KEY-INT
> 256)) (CODE-CHAR CL-GLFW::KEY-INT) (CL-GLFW::KEY-INT-TO-SYMBOL
> CL-GLFW::KEY-INT)) #<CCL::LEXICAL-ENVIRONMENT #x3020012F8C0D>)
>  8: (CCL::NX1-COMBINATION (IF (AND (>= CL-GLFW::KEY-INT 0) (<
> CL-GLFW::KEY-INT 256)) (CODE-CHAR CL-GLFW::KEY-INT)
> (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT))
> #<CCL::LEXICAL-ENVIRONMENT #x3020012F8C0D>)
>  9: (CCL::NX1-TRANSFORMED-FORM (IF (AND (>= CL-GLFW::KEY-INT 0) (<
> CL-GLFW::KEY-INT 256)) (CODE-CHAR CL-GLFW::KEY-INT)
> (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT))
> #<CCL::LEXICAL-ENVIRONMENT #x3020012F8..
> 10: (CCL::NX1-TYPED-FORM (IF (AND (>= CL-GLFW::KEY-INT 0) (<
> CL-GLFW::KEY-INT 256)) (CODE-CHAR CL-GLFW::KEY-INT)
> (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT))
> #<CCL::LEXICAL-ENVIRONMENT #x3020012F8C0D>)
> 11: (CCL::NX1-FORM (IF (AND (>= CL-GLFW::KEY-INT 0) (<
> CL-GLFW::KEY-INT 256)) (CODE-CHAR CL-GLFW::KEY-INT)
> (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT))
> #<CCL::LEXICAL-ENVIRONMENT #x3020012F8C0D>)
> 12: (CCL::NX1-BLOCK (BLOCK CL-GLFW:LISPIFY-KEY (IF (AND (>=
> CL-GLFW::KEY-INT 0) (< CL-GLFW::KEY-INT 256)) (CODE-CHAR
> CL-GLFW::KEY-INT) (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT)))
> #<CCL::LEXICAL-ENVIRO..
> 13: (CCL::NX1-COMBINATION (BLOCK CL-GLFW:LISPIFY-KEY (IF (AND (>=
> CL-GLFW::KEY-INT 0) (< CL-GLFW::KEY-INT 256)) (CODE-CHAR
> CL-GLFW::KEY-INT) (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT)))
> #<CCL::LEXICAL-..
> 14: (CCL::NX1-TRANSFORMED-FORM (BLOCK CL-GLFW:LISPIFY-KEY (IF (AND
> (>= CL-GLFW::KEY-INT 0) (< CL-GLFW::KEY-INT 256)) (CODE-CHAR
> CL-GLFW::KEY-INT) (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT)))
> #<CCL::LEX..
> 15: (CCL::NX1-TYPED-FORM (BLOCK CL-GLFW:LISPIFY-KEY (IF (AND (>=
> CL-GLFW::KEY-INT 0) (< CL-GLFW::KEY-INT 256)) (CODE-CHAR
> CL-GLFW::KEY-INT) (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT)))
> #<CCL::LEXICAL-E..
> 16: (CCL::NX1-FORM (BLOCK CL-GLFW:LISPIFY-KEY (IF (AND (>=
> CL-GLFW::KEY-INT 0) (< CL-GLFW::KEY-INT 256)) (CODE-CHAR
> CL-GLFW::KEY-INT) (CL-GLFW::KEY-INT-TO-SYMBOL CL-GLFW::KEY-INT)))
> #<CCL::LEXICAL-ENVIRON..
> 17: (CCL::NX1-ENV-BODY ((BLOCK CL-GLFW:LISPIFY-KEY (IF (AND # #)
> (CODE-CHAR CL-GLFW::KEY-INT) (CL-GLFW::KEY-INT-TO-SYMBOL
> CL-GLFW::KEY-INT)))) #<CCL::LEXICAL-ENVIRONMENT #x3020012F8DBD> NIL)
> 18: (CCL::NX1-LAMBDA (CL-GLFW::KEY-INT) ((BLOCK CL-GLFW:LISPIFY-KEY
> (IF (AND # #) (CODE-CHAR CL-GLFW::KEY-INT) (CL-GLFW::KEY-INT-TO-SYMBOL
> CL-GLFW::KEY-INT)))) ((DECLARE ..)))
> 19: (CCL::NX1-COMPILE-LAMBDA CL-GLFW:LISPIFY-KEY (LAMBDA
> (CL-GLFW::KEY-INT) ..) #<CCL::AFUNC #x3020012F8E0D> NIL
> #<CCL::LEXICAL-ENVIRONMENT #x3020012F8EDD> #<COMPILER-POLICY
> #x3020002698DD> #:LOAD-TIME-EV..
> 20: (CCL::COMPILE-NAMED-FUNCTION (LAMBDA (CL-GLFW::KEY-INT) ..) :NAME
> CL-GLFW:LISPIFY-KEY :ENV #<CCL::LEXICAL-ENVIRONMENT #x3020012F949D>
> :POLICY #<COMPILER-POLICY #x3020002698DD> :LOAD-TIME-EVAL-TOKEN #:..
> 21: (CCL::FCOMP-NAMED-FUNCTION (LAMBDA (CL-GLFW::KEY-INT) ..)
> CL-GLFW:LISPIFY-KEY #<CCL::LEXICAL-ENVIRONMENT #x302001256FBD>
> #<SOURCE-NOTE *"home:quicklisp;dists;quicklisp;software;cl-glfw-20101107-git;li..
> 22: (CCL::FCOMP-LOAD-%DEFUN (CCL::%DEFUN (NFUNCTION
> CL-GLFW:LISPIFY-KEY (LAMBDA (CL-GLFW::KEY-INT) (DECLARE #) (BLOCK
> CL-GLFW:LISPIFY-KEY #))) ..) #<CCL::LEXICAL-ENVIRONMENT
> #x302001256FBD>)
> 23: (CCL::FCOMP-FORM (CCL::%DEFUN (NFUNCTION CL-GLFW:LISPIFY-KEY
> (LAMBDA (CL-GLFW::KEY-INT) (DECLARE #) (BLOCK CL-GLFW:LISPIFY-KEY #)))
> ..) #<CCL::LEXICAL-ENVIRONMENT #x302001256FBD> :NOT-COMPILE-TIME)
> 24: (CCL::FCOMP-FORM-LIST ((CCL::%DEFUN (NFUNCTION
> CL-GLFW:LISPIFY-KEY (LAMBDA # # #)) ..))) #<CCL::LEXICAL-ENVIRONMENT
> #x302001256FBD> :NOT-COMPILE-TIME)
> 25: (CCL::FCOMP-FORM (PROGN (CCL::%DEFUN (NFUNCTION
> CL-GLFW:LISPIFY-KEY (LAMBDA # # #)) ..)) #<CCL::LEXICAL-ENVIRONMENT
> #x302001256FBD> :NOT-COMPILE-TIME)
> 26: (CCL::FCOMP-FORM (DEFUN CL-GLFW:LISPIFY-KEY (CL-GLFW::KEY-INT)
> ..) #<CCL::LEXICAL-ENVIRONMENT #x302001256FBD> :NOT-COMPILE-TIME)
> 27: (CCL::FCOMP-READ-LOOP
> "/home/jimrthy/quicklisp/dists/quicklisp/software/cl-glfw-20101107-git/lib/glfw.lisp"
> "home:quicklisp;dists;quicklisp;software;cl-glfw-20101107-git;lib;glfw.lisp.newest"
> 0 #<CCL:..
> 28: (CCL::FCOMP-FILE
> "/home/jimrthy/quicklisp/dists/quicklisp/software/cl-glfw-20101107-git/lib/glfw.lisp"
> "home:quicklisp;dists;quicklisp;software;cl-glfw-20101107-git;lib;glfw.lisp.newest"
> 0 #<CCL::LEXI..
> 29: (CCL::%COMPILE-FILE
> "/home/jimrthy/quicklisp/dists/quicklisp/software/cl-glfw-20101107-git/lib/glfw.lisp"
> "/home/jimrthy/.cache/common-lisp/ccl-1.5-f94-linux-amd64/home/jimrthy/quicklisp/dists/quickli..
> 30: (COMPILE-FILE
> #P"/home/jimrthy/quicklisp/dists/quicklisp/software/cl-glfw-20101107-git/lib/glfw.lisp"
> :OUTPUT-FILE #P"/home/jimrthy/.cache/common-lisp/ccl-1.5-f94-linux-amd64/home/jimrthy/quicklisp/di..
> 31: (ASDF:COMPILE-FILE*
> #P"/home/jimrthy/quicklisp/dists/quicklisp/software/cl-glfw-20101107-git/lib/glfw.lisp"
> :OUTPUT-FILE #P"/home/jimrthy/.cache/common-lisp/ccl-1.5-f94-linux-amd64/home/jimrthy/quickl..
> 32: (#<STANDARD-METHOD ASDF:PERFORM (ASDF:COMPILE-OP
> ASDF:CL-SOURCE-FILE)> #<COMPILE-OP (:VERBOSE NIL) #x302000ADB28D>
> #<CL-SOURCE-FILE "cl-glfw" "lib" "glfw">)
> 33: (CCL::%%BEFORE-AND-AFTER-COMBINED-METHOD-DCODE (NIL
> #<STANDARD-METHOD ASDF:PERFORM (ASDF:COMPILE-OP ASDF:CL-SOURCE-FILE)>
> . 17460012754508))
> 34: (CCL::%%STANDARD-COMBINED-METHOD-DCODE ((#<STANDARD-METHOD
> ASDF:PERFORM :BEFORE (ASDF:COMPILE-OP ASDF:SOURCE-FILE)>)
> (#<STANDARD-METHOD ASDF:PERFORM :AFTER (ASDF:OPERATION
> ASDF:COMPONENT)>) ..))) 1746..
> 35: (NIL #<Unknown Arguments>)
> 36: (CCL::%CALL-NEXT-METHOD (NIL #<STANDARD-METHOD
> ASDF::PERFORM-WITH-RESTARTS (T T)> . 17460012754557))
> 37: (#<STANDARD-METHOD ASDF::PERFORM-WITH-RESTARTS (ASDF:COMPILE-OP
> ASDF:CL-SOURCE-FILE)> #<COMPILE-OP (:VERBOSE NIL) #x302000ADB28D>
> #<CL-SOURCE-FILE "cl-glfw" "lib" "glfw">)
> 38: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD
> ASDF::PERFORM-WITH-RESTARTS (ASDF:COMPILE-OP ASDF:CL-SOURCE-FILE)>
> #<STANDARD-METHOD ASDF::PERFORM-WITH-RESTARTS (T T)>) 17460012754557)
> 39: (NIL #<Unknown Arguments>)
> 40: ((:INTERNAL CCL::WITH-COMPILATION-UNIT-BODY (ASDF:OPERATE (T T))))
> 41: (CCL::CALL-WITH-COMPILATION-UNIT #<COMPILED-LEXICAL-CLOSURE
> (:INTERNAL CCL::WITH-COMPILATION-UNIT-BODY (ASDF:OPERATE (T T)))
> #x7F09CEBB6C6F> :OVERRIDE NIL)
> 42: (#<STANDARD-METHOD ASDF:OPERATE (T T)> ASDF:LOAD-OP "cl-glfw" :VERBOSE NIL)
> 43: (QUICKLISP-CLIENT::CALL-WITH-MACROEXPAND-PROGRESS
> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL
> QUICKLISP-CLIENT::APPLY-LOAD-STRATEGY) #x302000AD56AF>)
> 44: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "cl-glfw" :PROMPT NIL)
> 45: (#<STANDARD-METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T
> T)> #<QL-IMPL:CCL #x3020006580AD> #<COMPILED-LEXICAL-CLOSURE
> (:INTERNAL QUICKLISP-CLIENT::QL ..))
> 46: (#<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD (T)> ("cl-glfw")
> :PROMPT NIL :VERBOSE NIL)
> 47: (CCL::CALL-CHECK-REGS QUICKLISP-CLIENT:QUICKLOAD "cl-glfw")
> 48: (CCL::CHEAP-EVAL (QUICKLISP-CLIENT:QUICKLOAD "cl-glfw"))
> 49: (SWANK::EVAL-REGION "(ql:quickload \"cl-glfw\")\n")
> 50: ((:INTERNAL SWANK::REPL-EVAL))
> 51: (SWANK::TRACK-PACKAGE #<COMPILED-LEXICAL-CLOSURE (:INTERNAL
> SWANK::REPL-EVAL) #x302000AD2BAF>)
> 52: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation
> request." #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::REPL-EVAL)
> #x302000AD2C2F>)
> 53: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<COMPILED-LEXICAL-CLOSURE
> (:INTERNAL SWANK::REPL-EVAL) #x302000AD2C6F>)
> 54: (SWANK::REPL-EVAL "(ql:quickload \"cl-glfw\")\n")
> 55: (CCL::CALL-CHECK-REGS SWANK:LISTENER-EVAL "(ql:quickload \"cl-glfw\")\n")
> 56: (CCL::CHEAP-EVAL (SWANK:LISTENER-EVAL "(ql:quickload \"cl-glfw\")\n"))
> 57: (SWANK:EVAL-FOR-EMACS (SWANK:LISTENER-EVAL "(ql:quickload
> \"cl-glfw\")\n") "COMMON-LISP-USER" 34)
> 58: (SWANK::PROCESS-REQUESTS NIL)
> 59: ((:INTERNAL SWANK::HANDLE-REQUESTS))
> 60: ((:INTERNAL SWANK::HANDLE-REQUESTS))
> 61: (SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK #<Compiled-function
> SWANK:SWANK-DEBUGGER-HOOK #x302000938A0F> #<COMPILED-LEXICAL-CLOSURE
> (:INTERNAL SWANK::HANDLE-REQUESTS) #x302000AC8B8F>)
> 62: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* .
> #<SWANK-BACKEND::SLIME-OUTPUT-STREAM #x302000AC7B3D>)
> (*STANDARD-INPUT* . #<SWANK-BACKEND::SLIME-INPUT-STREAM
> #x302000AC7EFD>) ..))) #<COMPILED-LEXICAL..
> 63: (SWANK::HANDLE-REQUESTS #<CONNECTION #x3020009AADAD> NIL)
> 64: (SWANK::CALL-WITH-BINDINGS NIL #<COMPILED-LEXICAL-CLOSURE
> (:INTERNAL SWANK::SPAWN-REPL-THREAD) #x302000AC8BDF>)
> 65: (CCL::RUN-PROCESS-INITIAL-FORM #<PROCESS repl-thread(9) [Active]
> #x302000AB695D> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL
> CCL::%PROCESS-RUN-FUNCTION) #x302000AB66FF>))
> 66: ((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<PROCESS
> repl-thread(9) [Active] #x302000AB695D> (#<COMPILED-LEXICAL-CLOSURE
> (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #x302000AB66FF>))
> 67: ((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))
>
>
> Here's the quicklisp output (in case anyone on here cares...this
> really started out as an email to Xach, but the error just doesn't
> seem to have much to do with quicklisp, unless it's some sort of
> sbcl/ccl incompatibility in the way ASDF's implemented):
>
> To load "cl-glfw":
>  Load 1 ASDF system:
>    cl-glfw
> ; Loading "cl-glfw"
> [package cl-glfw]
> Invoking restart: Try loading the foreign library again.
> ..............
> Invoking restart: Retry compiling
> #P"/home/jimrthy/quicklisp/dists/quicklisp/software/cl-glfw-20101107-git/lib/glfw.lisp"
> ..........
> Invoking restart: Retry getting the value of CL-GLFW:+KEY-BACKSPACE+.
>
> (yeah, I tried recompiling after I installed the dev package).
>
> Restarting emacs (and slime), which sometimes helps in these cases,
> didn't make any difference.
>
> Thanks, and Happy Holidays,
> James
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list