Clojure2D/clojure2d

clojure2d needs a fastmath dep update to work with clojure 1.11

puredanger opened this issue · 1 comments

Original problem in the wild: https://ask.clojure.org/index.php/11672/fastmath-errors-in-1-11

Simpler repro with clojure2d:

clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.11.0"} clojure2d/clojure2d {:mvn/version "1.4.3"}}}'

then

(require '[clojure2d.core :as c2d])

yields

WARNING: abs already refers to: #'clojure.core/abs in namespace: fastmath.core, being replaced by: #'fastmath.core/abs
Warning: protocol #'fastmath.protocols/VectorProto is overwriting function abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: fastmath.protocols, being replaced by: #'fastmath.protocols/abs
Reflection warning, fastmath/kernel.clj:72:1 - call to static method divide on fastmath.java.PrimitiveMath can't be resolved (argument types: unknown, double).

.... large number of similar reflection warnings elided
... slf4j warnings elided

Execution error (IllegalStateException) at fastmath.stats$median_absolute_deviation$fn__2570/invokePrim (stats.clj:227).
Attempting to call unbound fn: #'fastmath.core/abs

This problem does not occur with Clojure 1.10.3. Update the fastmath dependency to the latest (2.1.6) is sufficient to fix the problem when used with Clojure 1.11.0.

Thanks, it was tricky. Released 1.4.4 which depends on fastmath 2.1.8

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.11.0"} clojure2d/clojure2d {:mvn/version "1.4.4"}}}'
Clojure 1.11.0
(require '[clojure2d.core :as c2d] '[clojure2d.color :as c])
nil
((c/gradient [:red :blue]) 0.5)
#vec4 [127.5, 0.0, 127.5, 255.0]
user=>