prometheus.cl icon indicating copy to clipboard operation
prometheus.cl copied to clipboard

Support ClozureCL

Open svetlyak40wt opened this issue 6 years ago • 5 comments

Right now, attept to quickload of prometheus.examples leads to this error:

Illegal arg (EQL)
   [Condition of type CCL::SIMPLE-PROGRAM-ERROR]

Restarts:
 0: [CONTINUE] continue compilation ignoring this form
 1: [RETRY-COMPILE-FILE] Retry compiling #P"/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/formats/text/text.lisp"
 2: [SKIP-COMPILE-FILE] Skip compiling #P"/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/formats/text/text.lisp"
 3: [RETRY] Retry compiling #<CL-SOURCE-FILE "prometheus.formats.text" "src/formats/text" "text">.
 4: [ACCEPT] Continue, treating compiling #<CL-SOURCE-FILE "prometheus.formats.text" "src/formats/text" "text"> as having been successful.
 5: [RETRY] #<error printing RESTART #x2403348D>
 --more--

Backtrace:
 0: ((:INTERNAL CCL::FCOMP-MACROEXPAND-1) #<CCL::SIMPLE-PROGRAM-ERROR #x302002EC290D>)
 1: (SIGNAL #<CCL::SIMPLE-PROGRAM-ERROR #x302002EC290D>)
 2: (CCL::%ERROR #<CCL::SIMPLE-PROGRAM-ERROR #x302002EC290D> NIL 75374423)
 3: (CCL::PARSE-DEFMETHOD CATCH-STRANGE-FLOAT ("+Inf") #<CCL::LEXICAL-ENVIRONMENT #x302002EDE9AD>)
 4: (DEFMETHOD (DEFMETHOD CATCH-STRANGE-FLOAT ((VALUE (EQL))) "+Inf") #<CCL::LEXICAL-ENVIRONMENT #x302002EDE9AD>)
 5: (FUNCALL #<Compiled-function DEFMETHOD Macroexpander #x3000008F004F> (DEFMETHOD CATCH-STRANGE-FLOAT ((VALUE (EQL))) "+Inf") #<CCL::LEXICAL-ENVIRONMENT #x302002EDE9AD>)
 6: (MACROEXPAND-1 (DEFMETHOD CATCH-STRANGE-FLOAT ((VALUE (EQL))) "+Inf") #<CCL::LEXICAL-ENVIRONMENT #x302002EDE9AD>)
 7: (CCL::FCOMP-MACROEXPAND-1 (DEFMETHOD CATCH-STRANGE-FLOAT ((VALUE (EQL))) "+Inf") #<CCL::LEXICAL-ENVIRONMENT #x302002EDE9AD>)
 8: (CCL::FCOMP-FORM-1 (DEFMETHOD CATCH-STRANGE-FLOAT ((VALUE (EQL))) "+Inf") #<CCL::LEXICAL-ENVIRONMENT #x302002DC162D> :NOT-COMPILE-TIME)
 9: (CCL::FCOMP-FORM (DEFMETHOD CATCH-STRANGE-FLOAT ((VALUE (EQL))) "+Inf") #<CCL::LEXICAL-ENVIRONMENT #x302002DC162D> :NOT-COMPILE-TIME)
10: (CCL::FCOMP-READ-LOOP "/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/formats/text/text.lisp" "home:projects;lisp;test-prometheus;quicklisp;..
11: (CCL::FCOMP-FILE "/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/formats/text/text.lisp" "home:projects;lisp;test-prometheus;quicklisp;dists..
12: (CCL::%COMPILE-FILE "/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/formats/text/text.lisp" "/Users/art/.cache/common-lisp/ccl-1.11-f96-maco..
13: (COMPILE-FILE #P"/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/formats/text/text.lisp" :OUTPUT-FILE #P"/Users/art/.cache/common-lisp/ccl-1...

because these methods definitions are valid only for SBCL and ECL:

(defmethod catch-strange-float ((value (eql #+sbcl sb-ext:double-float-positive-infinity #+(and ecl ieee-floating-point) EXT:DOUBLE-FLOAT-POSITIVE-INFINITY)))
  "+Inf")

(defmethod catch-strange-float ((value (eql #+sbcl sb-ext:double-float-negative-infinity #+(and ecl ieee-floating-point) EXT:DOUBLE-FLOAT-negative-INFINITY)))
  "-Inf")

Probably, this can be fixed by prepending them with:

#+(or sbcl
      (and ecl ieee-floating-point))

However when I did this, I encounter another error:

There is no package named "SB-THREAD" .
   [Condition of type CCL::NO-SUCH-PACKAGE]

Restarts:
 0: [CONTINUE] Retry finding package with name "SB-THREAD".
 1: [USE-VALUE] Find specified package instead of "SB-THREAD" .
 2: [MAKE-NICKNAME] Make "SB-THREAD" be a nickname for package "PROMETHEUS.SBCL".
 3: [RETRY-COMPILE-FILE] Retry compiling #P"/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lisp"
 4: [SKIP-COMPILE-FILE] Skip compiling #P"/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lisp"
 5: [RETRY] Retry compiling #<CL-SOURCE-FILE "prometheus.collectors.sbcl" "src/collectors/sbcl" "threads">.
 --more--

Backtrace:
 0: (CCL::%PARSE-TOKEN #<BASIC-FILE-CHARACTER-INPUT-STREAM ("/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lisp"/10 UTF..
 1: (CCL::%PARSE-EXPRESSION #<BASIC-FILE-CHARACTER-INPUT-STREAM ("/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lisp"/1..
 2: (CCL::%READ-LIST-EXPRESSION #<BASIC-FILE-CHARACTER-INPUT-STREAM ("/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lis..
 3: (CCL::READ-LIST #<BASIC-FILE-CHARACTER-INPUT-STREAM ("/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lisp"/10 UTF-8)..
 4: (CCL::%PARSE-EXPRESSION #<BASIC-FILE-CHARACTER-INPUT-STREAM ("/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lisp"/1..
 5: (CCL::%READ-LIST-EXPRESSION #<BASIC-FILE-CHARACTER-INPUT-STREAM ("/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lis..
 6: (CCL::READ-LIST #<BASIC-FILE-CHARACTER-INPUT-STREAM ("/Users/art/projects/lisp/test-prometheus/quicklisp/dists/quicklisp/software/prometheus.cl-20160825-git/src/collectors/sbcl/threads.lisp"/10 UTF-8)..

svetlyak40wt avatar Apr 06 '19 06:04 svetlyak40wt

You are loading a SBCL thread file on CCL - that should not happen.

Why don't you use Bordeaux Threads instead and have cross-implementation thread support? Or are you using SBCL-specific features that BT does not cover?

phoe avatar Apr 06 '19 08:04 phoe

I have to look into sbcl/threads.lisp, probably it does collect some information about threads, specific to SBCL. In this case, some sort of fallback to Bordeaux Threads can be done for other implementations.

svetlyak40wt avatar Apr 20 '19 20:04 svetlyak40wt

https://github.com/deadtrickster/prometheus.cl/blob/45143f0299e7239461dca43bc870af2bfeb091fe/src/collectors/sbcl/threads.lisp

This file only contains one SBCL-specific call, which is (sb-thread:list-all-threads). This is equivalent to (bt:all-threads).

phoe avatar Apr 20 '19 20:04 phoe

Great!

svetlyak40wt avatar Apr 20 '19 20:04 svetlyak40wt

I hit this problem again :(

Seems src/formats/text/text.lisp is a core file for writing data in a proper Prometheus format. But it is not possible to load it on CCL.

@deadtrickster probably you have no time to support this system. Would you like to let me to maintain it?

svetlyak40wt avatar May 27 '23 23:05 svetlyak40wt