didierverna / declt

Reference manual generator for Common Lisp libraries
Other
38 stars 6 forks source link

declt fails to load #24

Closed jthing closed 7 months ago

jthing commented 1 year ago

I am using SBCL 2.7.3. It fails to load declt with message "Lock on package SB-KERNEL violated when interning DD-ELEMENT-TYPE while in package NET.DIDIERVERNA.DECLT.ASSESS."

output:

(ql:quickload :net.didierverna.declt) To load "net.didierverna.declt":
Load 1 ASDF system: net.didierverna.declt ; Loading "net.didierverna.declt" .. ; ; caught ERROR: ; READ error during COMPILE-FILE: ;
; Lock on package SB-KERNEL violated when interning DD-ELEMENT-TYPE while in ; package NET.DIDIERVERNA.DECLT.ASSESS. ; See also: ; The SBCL Manual, Node "Package Locks" ;
; (in form starting at line: 829, column: 0, position: 32253) ; Debugger entered on #<UIOP/LISP-BUILD:COMPILE-FILE-ERROR {10101A4873}> ;
; compilation unit aborted ; caught 2 fatal ERROR conditions ; caught 1 ERROR condition

Isolated it a function in symbol.lisp:

(defmethod initialize-instance :after ((definition typed-structure-definition) &key packages pathnames &aux (structure (definition-structure definition)) (source (source-by-object structure))) "Compute typed structure DEFINITION's type, element type, and slots." (setf (structure-type definition) (sb-kernel:dd-type structure)) (setf (element-type definition) (sb-kernel::dd-element-type structure)) (dolist (slot (sb-kernel:dd-slots structure)) (let ((slot-definition (make-typed-structure-slot-definition slot (not (domesticp (sb-kernel:dsd-name slot) source packages pathnames))))) (setf (owner slot-definition) definition) (endpush slot-definition (direct-slots definition)))))

snunez1 commented 1 year ago

Perhaps SBCL doesn't like using the internal package indicator ::. You might try changing it to : (a single colon) and see if that helps.

staudtlex commented 8 months ago

Declt loads without issues in SBCL 2.1.11 (which is the version shipped with Ubuntu 22.04.3. LTS).

I can however confirm that this issue occurs with SBCL versions 2.3.10. and 2.4.0 built from source. Below is the output SBCL 2.4.0/2.3.10 prints to stdout:

* (ql:quickload "net.didierverna.declt")
To load "net.didierverna.declt":
  Load 1 ASDF system:
    net.didierverna.declt
; Loading "net.didierverna.declt"
..................................................
[package net.didierverna.declt.assess]...;
; caught ERROR:
;   READ error during COMPILE-FILE:
;
;     Lock on package SB-KERNEL violated when interning DD-ELEMENT-TYPE while in
;     package NET.DIDIERVERNA.DECLT.ASSESS.
;   See also:
;     The SBCL Manual, Node "Package Locks"
;
;     (in form starting at line: 829, column: 0, position: 32253)

debugger invoked on a UIOP/LISP-BUILD:COMPILE-FILE-ERROR in thread
#<THREAD tid=82020 "main thread" RUNNING {10045201D3}>:
  COMPILE-FILE-ERROR while
  compiling #<CL-SOURCE-FILE "net.didierverna.declt.assess" "src" "symbol">

(UIOP/LISP-BUILD:CHECK-LISP-COMPILE-RESULTS NIL T T "~/asdf-action::format-action/" ((#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "net.didierverna.declt.assess" "src" "symbol">)))
   source: (ERROR 'COMPILE-FILE-ERROR :CONTEXT-FORMAT CONTEXT-FORMAT
                  :CONTEXT-ARGUMENTS CONTEXT-ARGUMENTS)
0]
;
; compilation unit aborted
;   caught 2 fatal ERROR conditions
;   caught 1 ERROR condition

Changing (sb-kernel::dd-element-type structure) to (sb-kernel:dd-element-type structure) as suggested by @snunez1 unfortunately does not resolve the issue.

didierverna commented 7 months ago

Hello,

I can't reproduce this. I've just pulled the latest SBCL (2.4.0...something) which I compiled --fancy. The latest Declt version compiles and loads fine, both with ql:quickload or with asdf:load-system on a local repository.

Besides, I fail to see how the package lock would be violated when I'm just calling the macro. It doesn't seem to be a case of violation as listed in section 12.1.5.2 of the SBCL manual...

staudtlex commented 7 months ago

Thank you for looking into this, @didierverna, and for pointing to the --fancy build flag.

Loading Declt with (ql:quickload "net.didierverna.declt") works perfectly well when SBCL is compiled with the --fancy flag. The loading issue described above arises when SBCL is not compiled with support for :SB-XREF-FOR-INTERNALS (which is included in --fancy).

didierverna commented 7 months ago

Nice, thank you. I never realized that. I will update the user manual to mention this requirement.