lvh / caesium

Modern cryptography (libsodium/NaCl) for Clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with the example

abhi18av opened this issue · comments

Hello @lvh

I saw your talk and found the project interesting. I've been trying to use this in a little project of mine but I run into the following error at the startup

CompilerException java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected, compiling:(caesium/binding.clj:244:1) 

Is there something I've missed out on during the installation.

I'm trying to use this lib in the following project clojure-cypher

commented

What example are you running exactly?

commented

I should probably elaborate a little more: can you give me a minimal reproducing sample? What environment are you running this on, etc :)

PS: Glad you liked my talk!

commented

FWIW, I can run lein test (which requires that code) fine:

lvh@plotka ~/P/clojure-cypher (master)> lein test
WARNING: key already refers to: #'clojure.core/key in namespace: clojure-cypher.core, being replaced by: #'clojure-cypher.core/key
WARNING: key already refers to: #'clojure.core/key in namespace: clojure-cypher.core-test, being replaced by: #'clojure-cypher.core/key

lein test clojure-cypher.core-test

lein test :only clojure-cypher.core-test/a-test

FAIL in (a-test) (core_test.clj:7)
FIXME, I fail.
expected: 0
  actual: 1
    diff: - 0
          + 1

Ran 1 tests containing 1 assertions.
1 failures, 0 errors.

Sure, my environment is as follows

  • clojure-1.8.0
  • java8
  • macOS Yosemite

At first I thought that I might have chose a wrong template or something so I tried on both lein new default and lein new app - but in an app environment this yields more errors.

commented

Can you provide an exact transcript of how to reproduce the failure?

commented

(Also, when you say "more errors", that doesn't give me much to debug with. Can you please also provide transcripts of that?)

@lvh , I appreciate your time and patience - being a newbie with Clojure I'm a bit clueless about how exactly I can help this process. However, if there's any instructions you'd like me to run on the machine - I'll be glad to help as much as I can.

  1. For the clojure-cypher project, I can run lein repl just fine and the errors that I get are the ones when I try to execute the commands on the example.clj
clojure-cypher git/master
❯ lein repl
nREPL server started on port 49425 on host 127.0.0.1 - nrepl://127.0.0.1:49425
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_91-b14
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (ns minimum-viable-secretbox
  #_=>   (:require [caesium.crypto.secretbox :as sb]))

CompilerException java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected, compiling:(caesium/binding.clj:244:1)
user=>
  1. On the hacking-secret-cyphers project, the stacktrace for lein repl is as follows.
hacking-secret-cyphers git/master
❯ lein repl
#error {
 :cause Found interface org.objectweb.asm.ClassVisitor, but class was expected
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected, compiling:(caesium/binding.clj:244:1)
   :at [clojure.lang.Compiler load Compiler.java 7391]}
  {:type java.lang.IncompatibleClassChangeError
   :message Found interface org.objectweb.asm.ClassVisitor, but class was expected
   :at [jnr.ffi.provider.jffi.AsmLibraryLoader generateInterfaceImpl AsmLibraryLoader.java 74]}]
 :trace
 [[jnr.ffi.provider.jffi.AsmLibraryLoader generateInterfaceImpl AsmLibraryLoader.java 74]
  [jnr.ffi.provider.jffi.AsmLibraryLoader loadLibrary AsmLibraryLoader.java 59]
  [jnr.ffi.provider.jffi.NativeLibraryLoader loadLibrary NativeLibraryLoader.java 44]
  [jnr.ffi.LibraryLoader load LibraryLoader.java 290]
  [jnr.ffi.LibraryLoader load LibraryLoader.java 269]
  [sun.reflect.NativeMethodAccessorImpl invoke0 NativeMethodAccessorImpl.java -2]
  [sun.reflect.NativeMethodAccessorImpl invoke NativeMethodAccessorImpl.java 62]
  [sun.reflect.DelegatingMethodAccessorImpl invoke DelegatingMethodAccessorImpl.java 43]
  [java.lang.reflect.Method invoke Method.java 498]
  [clojure.lang.Reflector invokeMatchingMethod Reflector.java 93]
  [clojure.lang.Compiler$InstanceMethodExpr eval Compiler.java 1525]
  [clojure.lang.Compiler$DefExpr eval Compiler.java 451]
  [clojure.lang.Compiler eval Compiler.java 6932]
  [clojure.lang.Compiler load Compiler.java 7379]
  [clojure.lang.RT loadResourceScript RT.java 372]
  [clojure.lang.RT loadResourceScript RT.java 363]
  [clojure.lang.RT load RT.java 453]
  [clojure.lang.RT load RT.java 419]
  [clojure.core$load$fn__5677 invoke core.clj 5893]
  [clojure.core$load invokeStatic core.clj 5892]
  [clojure.core$load doInvoke core.clj 5876]
  [clojure.lang.RestFn invoke RestFn.java 408]
  [clojure.core$load_one invokeStatic core.clj 5697]
  [clojure.core$load_one invoke core.clj 5692]
  [clojure.core$load_lib$fn__5626 invoke core.clj 5737]
  [clojure.core$load_lib invokeStatic core.clj 5736]
  [clojure.core$load_lib doInvoke core.clj 5717]
  [clojure.lang.RestFn applyTo RestFn.java 142]
  [clojure.core$apply invokeStatic core.clj 648]
  [clojure.core$load_libs invokeStatic core.clj 5774]
  [clojure.core$load_libs doInvoke core.clj 5758]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [clojure.core$apply invokeStatic core.clj 648]
  [clojure.core$require invokeStatic core.clj 5796]
  [clojure.core$require doInvoke core.clj 5796]
  [clojure.lang.RestFn invoke RestFn.java 457]
  [caesium.crypto.secretbox$eval22$loading__5569__auto____23 invoke secretbox.clj 1]
  [caesium.crypto.secretbox$eval22 invokeStatic secretbox.clj 1]
  [caesium.crypto.secretbox$eval22 invoke secretbox.clj 1]
  [clojure.lang.Compiler eval Compiler.java 6927]
  [clojure.lang.Compiler eval Compiler.java 6916]
  [clojure.lang.Compiler load Compiler.java 7379]
  [clojure.lang.RT loadResourceScript RT.java 372]
  [clojure.lang.RT loadResourceScript RT.java 363]
  [clojure.lang.RT load RT.java 453]
  [clojure.lang.RT load RT.java 419]
  [clojure.core$load$fn__5677 invoke core.clj 5893]
  [clojure.core$load invokeStatic core.clj 5892]
  [clojure.core$load doInvoke core.clj 5876]
  [clojure.lang.RestFn invoke RestFn.java 408]
  [clojure.core$load_one invokeStatic core.clj 5697]
  [clojure.core$load_one invoke core.clj 5692]
  [clojure.core$load_lib$fn__5626 invoke core.clj 5737]
  [clojure.core$load_lib invokeStatic core.clj 5736]
  [clojure.core$load_lib doInvoke core.clj 5717]
  [clojure.lang.RestFn applyTo RestFn.java 142]
  [clojure.core$apply invokeStatic core.clj 648]
  [clojure.core$load_libs invokeStatic core.clj 5774]
  [clojure.core$load_libs doInvoke core.clj 5758]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [clojure.core$apply invokeStatic core.clj 648]
  [clojure.core$require invokeStatic core.clj 5796]
  [clojure.core$require doInvoke core.clj 5796]
  [clojure.lang.RestFn invoke RestFn.java 408]
  [hacking_secret_cyphers.core$eval14$loading__5569__auto____15 invoke core.clj 5]
  [hacking_secret_cyphers.core$eval14 invokeStatic core.clj 5]
  [hacking_secret_cyphers.core$eval14 invoke core.clj 5]
  [clojure.lang.Compiler eval Compiler.java 6927]
  [clojure.lang.Compiler eval Compiler.java 6916]
  [clojure.lang.Compiler load Compiler.java 7379]
  [clojure.lang.RT loadResourceScript RT.java 372]
  [clojure.lang.RT loadResourceScript RT.java 363]
  [clojure.lang.RT load RT.java 453]
  [clojure.lang.RT load RT.java 419]
  [clojure.core$load$fn__5677 invoke core.clj 5893]
  [clojure.core$load invokeStatic core.clj 5892]
  [clojure.core$load doInvoke core.clj 5876]
  [clojure.lang.RestFn invoke RestFn.java 408]
  [clojure.core$load_one invokeStatic core.clj 5697]
  [clojure.core$load_one invoke core.clj 5692]
  [clojure.core$load_lib$fn__5626 invoke core.clj 5737]
  [clojure.core$load_lib invokeStatic core.clj 5736]
  [clojure.core$load_lib doInvoke core.clj 5717]
  [clojure.lang.RestFn applyTo RestFn.java 142]
  [clojure.core$apply invokeStatic core.clj 648]
  [clojure.core$load_libs invokeStatic core.clj 5774]
  [clojure.core$load_libs doInvoke core.clj 5758]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [clojure.core$apply invokeStatic core.clj 648]
  [clojure.core$require invokeStatic core.clj 5796]
  [clojure.core$require doInvoke core.clj 5796]
  [clojure.lang.RestFn invoke RestFn.java 408]
  [user$eval5 invokeStatic form-init2232054854133205768.clj 1]
  [user$eval5 invoke form-init2232054854133205768.clj 1]
  [clojure.lang.Compiler eval Compiler.java 6927]
  [clojure.lang.Compiler eval Compiler.java 6916]
  [clojure.lang.Compiler eval Compiler.java 6916]
  [clojure.lang.Compiler load Compiler.java 7379]
  [clojure.lang.Compiler loadFile Compiler.java 7317]
  [clojure.main$load_script invokeStatic main.clj 275]
  [clojure.main$init_opt invokeStatic main.clj 277]
  [clojure.main$init_opt invoke main.clj 277]
  [clojure.main$initialize invokeStatic main.clj 308]
  [clojure.main$null_opt invokeStatic main.clj 342]
  [clojure.main$null_opt invoke main.clj 339]
  [clojure.main$main invokeStatic main.clj 421]
  [clojure.main$main doInvoke main.clj 384]
  [clojure.lang.RestFn invoke RestFn.java 421]
  [clojure.lang.Var invoke Var.java 383]
  [clojure.lang.AFn applyToHelper AFn.java 156]
  [clojure.lang.Var applyTo Var.java 700]
  [clojure.main main main.java 37]]}
nREPL server started on port 49184 on host 127.0.0.1 - nrepl://127.0.0.1:49184
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_91-b14
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

hacking-secret-cyphers.core=>

Hope, this helps 👍

commented

Do you have libsodium installed? How?

Oh, I didn't know about the external dependency - I thought, it might be bundled with the jar or something.

So, I installed it with brew install libsodium but the errors are the same.

commented

Something is including an old version of asm. At some point, they changed Class from an interface to a class.

commented

Can you confirm that you're seeing this problem on a clean checkout of clojure-cypher? What do you get from lein repl to a clean checkout of caesium?

commented
lvh@plotka ~/P/clojure-cypher (master)> lein repl
nREPL server started on port 65150 on host 127.0.0.1 - nrepl://127.0.0.1:65150
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_112-b16
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (require 'caesium.crypto.secretbox)
nil
user=>

What commit do you have checked out exactly? (Please give me the full commit hash.)

I see that it has been working fine on your machine. To install the caesium I just added [caesium "0.9.0"]
to dependencies. So, it's the same as published in october on clojars.

Here's the commit link I followed from clojars

9ee7afd

commented

You mean [caesium "0.9.0"]? :) More importantly: what commit do you have checked out on those two failing projects; also; does lein repl work for you in the caesium repo?

commented

In the failing repo, can you run lein deps :tree?

Yup, corrected the error in the last commit.

lein deps :tree sort of unleashes the entire ./m2 over here.

clojure-cypher git/master
❯ lein deps :tree
Possibly confusing dependencies found:
[org.clojure/core.memoize "0.5.8"]
 overrides
[binaryage/dirac "0.6.4"] -> [org.clojure/core.async "0.2.385"] -> [org.clojure/tools.analyzer.jvm "0.6.10"] -> [org.clojure/core.memoize "0.5.9"]
 and
[org.clojure/core.async "0.2.385"] -> [org.clojure/tools.analyzer.jvm "0.6.10"] -> [org.clojure/core.memoize "0.5.9"]

Consider using these exclusions:
[binaryage/dirac "0.6.4" :exclusions [org.clojure/core.memoize]]
[org.clojure/core.async "0.2.385" :exclusions [org.clojure/core.memoize]]

[aysylu/loom "0.6.0"] -> [org.clojure/data.priority-map "0.0.5"]
 overrides
[binaryage/dirac "0.6.4"] -> [org.clojure/core.async "0.2.385"] -> [org.clojure/tools.analyzer.jvm "0.6.10"] -> [org.clojure/core.memoize "0.5.9"] -> [org.clojure/core.cache "0.6.5"] -> [org.clojure/data.priority-map "0.0.7"]
 and
[org.clojure/core.async "0.2.385"] -> [org.clojure/tools.analyzer.jvm "0.6.10"] -> [org.clojure/core.memoize "0.5.9"] -> [org.clojure/core.cache "0.6.5"] -> [org.clojure/data.priority-map "0.0.7"]
 and
[org.clojure/core.cache "0.6.5"] -> [org.clojure/data.priority-map "0.0.7"]

Consider using these exclusions:
[binaryage/dirac "0.6.4" :exclusions [org.clojure/data.priority-map]]
[org.clojure/core.async "0.2.385" :exclusions [org.clojure/data.priority-map]]
[org.clojure/core.cache "0.6.5" :exclusions [org.clojure/data.priority-map]]

[edu.stanford.nlp/stanford-corenlp "3.6.0"] -> [org.slf4j/slf4j-api "1.7.12"]
 overrides
[net.sourceforge.tess4j/tess4j "3.2.1"] -> [org.slf4j/log4j-over-slf4j "1.7.21"] -> [org.slf4j/slf4j-api "1.7.21"]
 and
[net.sourceforge.tess4j/tess4j "3.2.1"] -> [org.slf4j/jcl-over-slf4j "1.7.21"] -> [org.slf4j/slf4j-api "1.7.21"]
 and
[net.sourceforge.tess4j/tess4j "3.2.1"] -> [org.slf4j/jul-to-slf4j "1.7.21"] -> [org.slf4j/slf4j-api "1.7.21"]
 and
[net.sourceforge.tess4j/tess4j "3.2.1"] -> [ch.qos.logback/logback-classic "1.1.7"] -> [org.slf4j/slf4j-api "1.7.20"]

Consider using these exclusions:
[net.sourceforge.tess4j/tess4j "3.2.1" :exclusions [org.slf4j/slf4j-api]]
[net.sourceforge.tess4j/tess4j "3.2.1" :exclusions [org.slf4j/slf4j-api]]
[net.sourceforge.tess4j/tess4j "3.2.1" :exclusions [org.slf4j/slf4j-api]]
[net.sourceforge.tess4j/tess4j "3.2.1" :exclusions [org.slf4j/slf4j-api]]

[org.apache.shiro/shiro-core "1.3.2"] -> [commons-beanutils "1.8.3" :exclusions [commons-logging]]
 overrides
[net.sourceforge.tess4j/tess4j "3.2.1"] -> [org.ghost4j/ghost4j "1.0.1"] -> [commons-beanutils "1.9.2"]

Consider using these exclusions:
[net.sourceforge.tess4j/tess4j "3.2.1" :exclusions [commons-beanutils]]

[devcards "0.2.1-7"] -> [cljsjs/react "0.14.3-0"]
 overrides
[re-frame "0.8.0"] -> [reagent "0.6.0-rc"] -> [cljsjs/react-dom-server "15.1.0-0"] -> [cljsjs/react "15.1.0-0"]
 and
[re-frame "0.8.0"] -> [reagent "0.6.0-rc"] -> [cljsjs/react-dom "15.1.0-0"] -> [cljsjs/react "15.1.0-0"]
 and
[reagent "0.6.0-rc"] -> [cljsjs/react-dom-server "15.1.0-0"] -> [cljsjs/react "15.1.0-0"]
 and
[reagent "0.6.0-rc"] -> [cljsjs/react-dom "15.1.0-0"] -> [cljsjs/react "15.1.0-0"]

Consider using these exclusions:
[re-frame "0.8.0" :exclusions [cljsjs/react]]
[re-frame "0.8.0" :exclusions [cljsjs/react]]
[reagent "0.6.0-rc" :exclusions [cljsjs/react]]
[reagent "0.6.0-rc" :exclusions [cljsjs/react]]

[net.sourceforge.tess4j/tess4j "3.2.1"] -> [org.ghost4j/ghost4j "1.0.1"] -> [org.apache.xmlgraphics/xmlgraphics-commons "1.4"] -> [commons-logging "1.0.4"]
 overrides
[clojureverbalexpressions "0.2.1"] -> [midje "1.5.1"] -> [leiningen-core "2.0.0-preview10"] -> [com.cemerick/pomegranate "0.0.13" :exclusions [org.slf4j/slf4j-api]] -> [org.apache.maven.wagon/wagon-http "2.2"] -> [org.apache.maven.wagon/wagon-http-shared4 "2.2"] -> [org.apache.httpcomponents/httpclient "4.1.2"] -> [commons-logging "1.1.1"]
 and
[clojureverbalexpressions "0.2.1"] -> [midje "1.5.1"] -> [leiningen-core "2.0.0-preview10"] -> [com.cemerick/pomegranate "0.0.13" :exclusions [org.slf4j/slf4j-api]] -> [org.apache.maven.wagon/wagon-http "2.2"] -> [org.apache.httpcomponents/httpclient "4.1.2"] -> [commons-logging "1.1.1"]
 and
[clojureverbalexpressions "0.2.1"] -> [midje "1.5.1"] -> [leiningen-core "2.0.0-preview10"] -> [com.cemerick/pomegranate "0.0.13" :exclusions [org.slf4j/slf4j-api]] -> [org.apache.maven.wagon/wagon-http "2.2"] -> [org.apache.maven.wagon/wagon-http-shared4 "2.2"] -> [commons-logging "1.1.1"]
 and
[lein-ancient "0.6.10"] -> [com.amazonaws/aws-java-sdk-s3 "1.9.0" :exclusions [joda-time]] -> [com.amazonaws/aws-java-sdk-core "1.9.0"] -> [org.apache.httpcomponents/httpclient "4.2"] -> [commons-logging "1.1.1"]
 and
[lein-ancient "0.6.10"] -> [com.amazonaws/aws-java-sdk-s3 "1.9.0" :exclusions [joda-time]] -> [com.amazonaws/aws-java-sdk-core "1.9.0"] -> [commons-logging "1.1.1"]
 and
[net.sourceforge.tess4j/tess4j "3.2.1"] -> [org.ghost4j/ghost4j "1.0.1"] -> [commons-beanutils "1.9.2"] -> [commons-logging "1.1.1"]

Consider using these exclusions:
[clojureverbalexpressions "0.2.1" :exclusions [commons-logging]]
[clojureverbalexpressions "0.2.1" :exclusions [commons-logging]]
[clojureverbalexpressions "0.2.1" :exclusions [commons-logging]]
[lein-ancient "0.6.10" :exclusions [commons-logging]]
[lein-ancient "0.6.10" :exclusions [commons-logging]]
[net.sourceforge.tess4j/tess4j "3.2.1" :exclusions [commons-logging]]

[clojureverbalexpressions "0.2.1"] -> [midje "1.5.1"] -> [leiningen-core "2.0.0-preview10"] -> [com.cemerick/pomegranate "0.0.13" :exclusions [org.slf4j/slf4j-api]] -> [org.sonatype.aether/aether-connector-wagon "1.13.1"] -> [org.codehaus.plexus/plexus-utils "2.0.7"]
 overrides
[clojureverbalexpressions "0.2.1"] -> [midje "1.5.1"] -> [leiningen-core "2.0.0-preview10"] -> [com.cemerick/pomegranate "0.0.13" :exclusions [org.slf4j/slf4j-api]] -> [org.apache.maven.wagon/wagon-http "2.2"] -> [org.apache.maven.wagon/wagon-http-shared4 "2.2"] -> [org.apache.maven.wagon/wagon-provider-api "2.2"] -> [org.codehaus.plexus/plexus-utils "3.0"]
 and
[clojureverbalexpressions "0.2.1"] -> [midje "1.5.1"] -> [leiningen-core "2.0.0-preview10"] -> [com.cemerick/pomegranate "0.0.13" :exclusions [org.slf4j/slf4j-api]] -> [org.apache.maven.wagon/wagon-http "2.2"] -> [org.apache.maven.wagon/wagon-provider-api "2.2"] -> [org.codehaus.plexus/plexus-utils "3.0"]
 and
[clojureverbalexpressions "0.2.1"] -> [midje "1.5.1"] -> [leiningen-core "2.0.0-preview10"] -> [com.cemerick/pomegranate "0.0.13" :exclusions [org.slf4j/slf4j-api]] -> [org.apache.maven.wagon/wagon-provider-api "2.2"] -> [org.codehaus.plexus/plexus-utils "3.0"]

Consider using these exclusions:
[clojureverbalexpressions "0.2.1" :exclusions [org.codehaus.plexus/plexus-utils]]
[clojureverbalexpressions "0.2.1" :exclusions [org.codehaus.plexus/plexus-utils]]
[clojureverbalexpressions "0.2.1" :exclusions [org.codehaus.plexus/plexus-utils]]

 [automat "0.2.0"]
   [potemkin "0.4.3"]
     [riddley "0.1.12"]
   [primitive-math "0.1.5"]
   [proteus "0.1.6"]
   [rhizome "0.2.7"]
 [aysylu/loom "0.6.0"]
   [org.clojure/data.priority-map "0.0.5"]
   [tailrecursion/cljs-priority-map "1.1.0"]
 [binaryage/devtools "0.8.1"]
 [binaryage/dirac "0.6.4"]
   [clj-logging-config "1.9.12"]
   [environ "1.1.0"]
   [http-kit "2.2.0"]
   [org.clojure/tools.logging "0.3.1"]
   [version-clj "0.1.2"]
 [caesium "0.9.0"]
   [byte-streams "0.2.2"]
     [clj-tuple "0.2.2"]
     [manifold "0.1.4"]
       [io.aleph/dirigiste "0.1.3"]
   [com.github.jnr/jnr-ffi "2.0.9"]
     [com.github.jnr/jffi "1.2.11"]
     [com.github.jnr/jffi "1.2.11" :classifier "native" :scope "runtime"]
     [com.github.jnr/jnr-x86asm "1.0.2"]
     [org.ow2.asm/asm-analysis "5.0.3"]
     [org.ow2.asm/asm-commons "5.0.3"]
     [org.ow2.asm/asm-tree "5.0.3"]
     [org.ow2.asm/asm-util "5.0.3"]
     [org.ow2.asm/asm "5.0.3"]
   [commons-codec "1.10"]
   [medley "0.8.3"]
 [clansi "1.0.0"]
 [cljsjs/chance "0.7.3-0"]
 [cljsjs/d3 "4.2.0-0"]
 [cljsjs/semantic-ui "2.2.2-0"]
   [cljsjs/jquery "2.2.2-0"]
 [clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
 [clojureverbalexpressions "0.2.1"]
   [midje "1.5.1"]
     [bultitude "0.1.7"]
     [colorize "0.1.1" :exclusions [[org.clojure/clojure]]]
     [gui-diff "0.3.9"]
     [leiningen-core "2.0.0-preview10"]
       [classlojure "0.6.6"]
         [useful "0.8.3-alpha8"]
       [com.cemerick/pomegranate "0.0.13" :exclusions [[org.slf4j/slf4j-api]]]
         [org.apache.maven.wagon/wagon-http "2.2"]
           [org.apache.maven.wagon/wagon-http-shared4 "2.2"]
         [org.apache.maven.wagon/wagon-provider-api "2.2"]
         [org.apache.maven/maven-aether-provider "3.0.4"]
           [org.apache.maven/maven-model-builder "3.0.4"]
             [org.codehaus.plexus/plexus-interpolation "1.14"]
           [org.apache.maven/maven-model "3.0.4"]
           [org.apache.maven/maven-repository-metadata "3.0.4"]
           [org.codehaus.plexus/plexus-component-annotations "1.5.5" :exclusions [[junit]]]
         [org.sonatype.aether/aether-api "1.13.1"]
         [org.sonatype.aether/aether-connector-file "1.13.1"]
         [org.sonatype.aether/aether-connector-wagon "1.13.1"]
           [org.codehaus.plexus/plexus-classworlds "2.4"]
           [org.codehaus.plexus/plexus-utils "2.0.7"]
           [org.sonatype.sisu/sisu-inject-plexus "2.2.3"]
             [org.sonatype.sisu/sisu-inject-bean "2.2.3"]
               [org.sonatype.sisu/sisu-guice "3.0.3" :classifier "no_aop" :exclusions [[javax.inject] [aopalliance]]]
         [org.sonatype.aether/aether-impl "1.13.1"]
           [org.sonatype.aether/aether-spi "1.13.1"]
         [org.sonatype.aether/aether-util "1.13.1"]
       [robert/hooke "1.1.2"]
     [ordered "1.2.0" :exclusions [[org.clojure/clojure]]]
     [org.clojure/algo.monads "0.1.0"]
     [org.clojure/core.incubator "0.1.0"]
     [slingshot "0.10.3"]
     [swiss-arrows "0.1.0"]
     [utilize "0.2.3" :exclusions [[org.clojure/clojure]]]
 [com.cemerick/piggieback "0.2.1"]
 [com.cognitect/transit-clj "0.8.293"]
   [com.cognitect/transit-java "0.8.316"]
     [com.fasterxml.jackson.core/jackson-core "2.3.2"]
     [org.msgpack/msgpack "0.6.12"]
       [com.googlecode.json-simple/json-simple "1.1.1" :exclusions [[junit]]]
       [org.javassist/javassist "3.18.1-GA"]
 [com.cognitect/transit-cljs "0.8.239"]
   [com.cognitect/transit-js "0.8.846"]
 [com.google.code.gson/gson "2.8.0"]
 [com.google.guava/guava "19.0"]
 [com.google.jimfs/jimfs "1.1"]
 [com.ibm.icu/icu4j "57.1"]
 [com.itextpdf/itextpdf "5.5.10"]
 [com.twelvemonkeys.imageio/imageio-core "3.3"]
   [com.twelvemonkeys.common/common-image "3.3"]
   [com.twelvemonkeys.common/common-io "3.3"]
   [com.twelvemonkeys.common/common-lang "3.3"]
 [commons-io "2.5"]
 [devcards "0.2.1-7"]
   [cljs-react-reload "0.1.1"]
   [cljsjs/react "0.14.3-0"]
   [cljsjs/showdown "0.4.0-1"]
   [sablono "0.5.3"]
 [edu.stanford.nlp/stanford-corenlp "3.6.0"]
   [com.googlecode.efficient-java-matrix-library/ejml "0.23"]
   [com.io7m.xom/xom "1.2.10"]
     [xalan "2.7.0"]
     [xerces/xercesImpl "2.8.0"]
     [xml-apis "1.3.03"]
   [de.jollyday/jollyday "0.4.7"]
     [javax.xml.bind/jaxb-api "2.2.7"]
   [javax.json/javax.json-api "1.0"]
   [joda-time "2.9"]
   [org.slf4j/slf4j-api "1.7.12"]
 [frak "0.1.6"]
 [funcool/cats "2.0.0"]
 [funcool/cuerdas "2.0.0"]
 [funcool/promesa "1.5.0"]
 [hiccup "1.0.5"]
 [hickory "0.6.0"]
   [org.jsoup/jsoup "1.7.1"]
   [quoin "0.1.0"]
 [instaparse "1.4.3"]
 [io.aviso/pretty "0.1.30"]
 [jline "2.12"]
 [korma "0.4.3"]
   [com.mchange/c3p0 "0.9.5.2"]
     [com.mchange/mchange-commons-java "0.2.11"]
   [org.clojure/java.jdbc "0.6.1"]
 [lein-ancient "0.6.10"]
   [com.amazonaws/aws-java-sdk-s3 "1.9.0" :exclusions [[joda-time]]]
     [com.amazonaws/aws-java-sdk-core "1.9.0"]
       [com.fasterxml.jackson.core/jackson-annotations "2.1.1"]
       [com.fasterxml.jackson.core/jackson-databind "2.1.1"]
       [org.apache.httpcomponents/httpclient "4.2"]
         [org.apache.httpcomponents/httpcore "4.2"]
 [net.bytebuddy/byte-buddy "1.5.3"]
 [net.cgrand/seqexp "0.6.0"]
 [net.sourceforge.tess4j/tess4j "3.2.1"]
   [ch.qos.logback/logback-classic "1.1.7"]
     [ch.qos.logback/logback-core "1.1.7"]
   [com.github.jai-imageio/jai-imageio-core "1.3.1"]
   [net.java.dev.jna/jna "4.1.0"]
   [net.sourceforge.lept4j/lept4j "1.2.3"]
     [org.rococoa/rococoa-core "0.5"]
       [cglib "2.2.2"]
         [asm "3.3.1"]
   [org.ghost4j/ghost4j "1.0.1"]
     [log4j "1.2.17" :exclusions [[com.sun.jdmk/jmxtools] [javax.mail/mail] [com.sun.jmx/jmxri] [javax.jms/jms]]]
     [org.apache.xmlgraphics/xmlgraphics-commons "1.4"]
       [commons-logging "1.0.4"]
   [org.slf4j/jcl-over-slf4j "1.7.21"]
   [org.slf4j/jul-to-slf4j "1.7.21"]
   [org.slf4j/log4j-over-slf4j "1.7.21"]
 [org.apache.commons/commons-compress "1.5"]
   [org.tukaani/xz "1.2"]
 [org.apache.commons/commons-lang3 "3.5"]
 [org.apache.commons/commons-math3 "3.6.1"]
 [org.apache.shiro/shiro-core "1.3.2"]
   [commons-beanutils "1.8.3" :exclusions [[commons-logging]]]
 [org.clojure/algo.generic "0.1.2"]
 [org.clojure/clojure "1.8.0"]
 [org.clojure/clojurescript "1.9.229"]
   [com.google.javascript/closure-compiler-unshaded "v20160315"]
     [args4j "2.0.26"]
     [com.google.code.findbugs/jsr305 "1.3.9"]
     [com.google.javascript/closure-compiler-externs "v20160315"]
     [com.google.protobuf/protobuf-java "2.5.0"]
   [org.clojure/google-closure-library "0.0-20160609-f42b4a24"]
     [org.clojure/google-closure-library-third-party "0.0-20160609-f42b4a24"]
   [org.clojure/tools.reader "1.0.0-beta3"]
   [org.mozilla/rhino "1.7R5"]
 [org.clojure/core.async "0.2.385"]
   [org.clojure/tools.analyzer.jvm "0.6.10"]
     [org.ow2.asm/asm-all "4.2"]
 [org.clojure/core.cache "0.6.5"]
 [org.clojure/core.logic "0.8.10"]
 [org.clojure/core.match "0.3.0-alpha4"]
 [org.clojure/core.memoize "0.5.8"]
 [org.clojure/core.typed "0.3.23"]
   [org.clojure/core.contracts "0.0.4" :exclusions [[org.clojure/clojure]]]
     [org.clojure/core.unify "0.5.3"]
   [org.clojure/core.typed.rt "0.3.23"]
   [org.clojure/jvm.tools.analyzer "0.6.1" :exclusions [[org.clojure/clojurescript]]]
 [org.clojure/data.csv "0.1.3"]
 [org.clojure/data.generators "0.1.2"]
 [org.clojure/data.json "0.2.6"]
 [org.clojure/java.classpath "0.2.3"]
 [org.clojure/math.combinatorics "0.1.3"]
 [org.clojure/test.check "0.9.0"]
 [org.clojure/tools.analyzer "0.6.9"]
 [org.clojure/tools.cli "0.3.5"]
 [org.clojure/tools.macro "0.1.2"]
 [org.clojure/tools.namespace "0.2.11"]
 [org.clojure/tools.nrepl "0.2.12" :exclusions [[org.clojure/clojure]]]
 [org.imgscalr/imgscalr-lib "4.2"]
 [quil "2.4.0"]
   [com.lowagie/itext "2.1.7"]
     [bouncycastle/bcmail-jdk14 "138"]
     [bouncycastle/bcprov-jdk14 "138"]
     [org.bouncycastle/bctsp-jdk14 "1.38"]
       [org.bouncycastle/bcmail-jdk14 "1.38"]
       [org.bouncycastle/bcprov-jdk14 "1.38"]
   [quil/gluegen-rt-fat "2.3.2"]
   [quil/jogl-all-fat "2.3.2"]
   [quil/processing-core "3.0.2"]
   [quil/processing-dxf "3.0.2.1"]
   [quil/processing-js "1.4.16.0"]
   [quil/processing-pdf "3.0.2"]
 [re-frame "0.8.0"]
 [reagent "0.6.0-rc"]
   [cljsjs/react-dom-server "15.1.0-0"]
   [cljsjs/react-dom "15.1.0-0"]
 [rewrite-clj "0.6.0"]
 [ru.lanwen.verbalregex/java-verbal-expressions "1.4"]
 [semantic-csv "0.1.0"]
   [clojure-csv "2.0.1"]
 [spyscope "0.1.5"]
   [clj-time "0.7.0"]

clojure-cypher git/master
❯
commented

That has a giant pile of dependencies that aren't i clojure-cypher as it lives on Github... That's pretty important :)

Notably:

 [net.sourceforge.tess4j/tess4j "3.2.1"]
   [ch.qos.logback/logback-classic "1.1.7"]
     [ch.qos.logback/logback-core "1.1.7"]
   [com.github.jai-imageio/jai-imageio-core "1.3.1"]
   [net.java.dev.jna/jna "4.1.0"]
   [net.sourceforge.lept4j/lept4j "1.2.3"]
     [org.rococoa/rococoa-core "0.5"]
       [cglib "2.2.2"]
         [asm "3.3.1"]

^ that is using an ancient version of asm and that's where the bug is.

Hey, in the meantime I've downloaded the caesium-master from github and ran lein repl as you instructed. It downloads the jar again.

hacking_secret_cyphers_with_clojure/resources/caesium-master git/master
❯ lein repl
Retrieving com/github/jnr/jnr-ffi/2.1.0/jnr-ffi-2.1.0.pom from central
Retrieving com/github/jnr/jffi/1.2.13/jffi-1.2.13.pom from central
Retrieving criterium/criterium/0.4.4/criterium-0.4.4.pom from clojars
Retrieving com/gfredericks/test.chuck/0.2.7/test.chuck-0.2.7.pom from clojars
Retrieving clj-time/clj-time/0.10.0/clj-time-0.10.0.pom from clojars
Retrieving com/andrewmcveigh/cljs-time/0.3.11/cljs-time-0.3.11.pom from clojars
Retrieving instaparse/instaparse/1.3.6/instaparse-1.3.6.pom from clojars
Retrieving com/taoensso/timbre/4.7.3/timbre-4.7.3.pom from clojars
Retrieving com/taoensso/encore/2.67.2/encore-2.67.2.pom from clojars
Retrieving com/taoensso/truss/1.3.3/truss-1.3.3.pom from clojars
Retrieving io/aviso/pretty/0.1.29/pretty-0.1.29.pom from clojars
Retrieving com/github/jnr/jffi/1.2.13/jffi-1.2.13-native.jar from central
Retrieving com/github/jnr/jffi/1.2.13/jffi-1.2.13.jar from central
Retrieving com/github/jnr/jnr-ffi/2.1.0/jnr-ffi-2.1.0.jar from central
Retrieving criterium/criterium/0.4.4/criterium-0.4.4.jar from clojars
Retrieving com/taoensso/timbre/4.7.3/timbre-4.7.3.jar from clojars
Retrieving com/gfredericks/test.chuck/0.2.7/test.chuck-0.2.7.jar from clojars
Retrieving com/taoensso/encore/2.67.2/encore-2.67.2.jar from clojars
Retrieving com/andrewmcveigh/cljs-time/0.3.11/cljs-time-0.3.11.jar from clojars
Retrieving com/taoensso/truss/1.3.3/truss-1.3.3.jar from clojars
Reflection warning, clojure/tools/nrepl/middleware/load_file.clj:87:38 - reference to field recv on java.lang.Object can't be resolved.
Reflection warning, clojure/tools/nrepl/middleware/load_file.clj:88:46 - call to method recv on java.lang.Object can't be resolved (no such method).
Reflection warning, clojure/tools/nrepl/middleware/load_file.clj:93:27 - call to method send on java.lang.Object can't be resolved (no such method).
Reflection warning, clojure/tools/nrepl/server.clj:142:21 - call to java.net.InetSocketAddress ctor can't be resolved.
Reflection warning, /private/var/folders/vt/9ywhthp94tz2b_23l97x9zcc0000gn/T/form-init849510507577009903.clj:1:3216 - reference to field deleteOnExit can't be resolved.
nREPL server started on port 49906 on host 127.0.0.1 - nrepl://127.0.0.1:49906
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_91-b14
Reflection warning, /private/var/folders/vt/9ywhthp94tz2b_23l97x9zcc0000gn/T/form-init849510507577009903.clj:1:1589 - reference to field ns can't be resolved.
Reflection warning, /private/var/folders/vt/9ywhthp94tz2b_23l97x9zcc0000gn/T/form-init849510507577009903.clj:1:3831 - reference to field name can't be resolved.
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

caesium.core=> exit
Bye for now!

For the next lein repl, it gives a bunch of warnings

Reflection warning, clojure/tools/nrepl/middleware/load_file.clj:87:38 - reference to field recv on java.lang.Object can't be resolved.
Reflection warning, clojure/tools/nrepl/middleware/load_file.clj:88:46 - call to method recv on java.lang.Object can't be resolved (no such method).
Reflection warning, clojure/tools/nrepl/middleware/load_file.clj:93:27 - call to method send on java.lang.Object can't be resolved (no such method).
Reflection warning, clojure/tools/nrepl/server.clj:142:21 - call to java.net.InetSocketAddress ctor can't be resolved.
Reflection warning, /private/var/folders/vt/9ywhthp94tz2b_23l97x9zcc0000gn/T/form-init5706933338476009575.clj:1:3217 - reference to field deleteOnExit can't be resolved.

Thanks for that identification! How can I correct that ?

commented

Yeah, those warnings are fine, they're just reflection warnings which I use to find performance optimization hotspots. The reason caesium works and clojure-cypher does not is because of the extra dependencies you have in your local copy that aren't in clojure-cypher.

To fix: get tess4j to upgrade to a reasonably current version of the (transitive) asm dependency. This isn't a caesium problem. tess4j is transitively pulling in an old version of asm. If the new version of asm works, you might be able to just :exclude the asm dependency.

commented

(I'm closing this since it's not a caesium bug but a tess4j bug.)

I'm not mad or anything, but in the future, it's really important to submit SSCCEs. The sample you pointed me at just has caesium and clojure as dependencies, but the actual problem was in a giant pile of dependencies that isn't in the project on Github. Being able to reproduce your problem is step one. Ideally, be able to reproduce it on a CI service like Travis CI.

@lvh , I get what you're suggesting but 3.2.1 seems to be the latest version on maven. Perhaps I should remove it altogether from the .lein/profiles.cjl ?

I've found that simple ruby scripts are fine for my tesseract needs.

After removal here's what I get inside the clojure-cypher repl

clojure-cypher git/master
❯ lein repl
nREPL server started on port 50073 on host 127.0.0.1 - nrepl://127.0.0.1:50073
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_91-b14
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (ns clojure-cypher.core
  #_=>   (:require [caesium.crypto.secretbox :as sb]))
nil
clojure-cypher.core=>

clojure-cypher.core=>

clojure-cypher.core=> (def key (sb/new-key!))
WARNING: key already refers to: #'clojure.core/key in namespace: clojure-cypher.core, being replaced by: #'clojure-cypher.core/key
#'clojure-cypher.core/key
clojure-cypher.core=> (def plaintext "Hello caesium!")
#'clojure-cypher.core/plaintext
clojure-cypher.core=> (def nonce (sb/int->nonce 0))
#'clojure-cypher.core/nonce
clojure-cypher.core=> (def ciphertext (sb/encrypt key nonce (.getBytes plaintext)))
#'clojure-cypher.core/ciphertext
clojure-cypher.core=> (def roundtrip (String. (sb/decrypt key nonce ciphertext)))
#'clojure-cypher.core/roundtrip
clojure-cypher.core=> (assert (= plaintext roundtrip))
nil
clojure-cypher.core=> (sb/
sb/decrypt
sb/encrypt
sb/int->nonce
sb/keybytes
sb/macbytes
sb/new-key!
sb/noncebytes
sb/primitive
sb/secretbox-easy
sb/secretbox-easy-to-buf!
sb/secretbox-open-easy
sb/secretbox-open-easy-to-buf!
clojure-cypher.core=> (sb/
commented

@abhi18av I'm suggesting you get tess4j to upgrade to a new transitive dependency version of asm, not upgrade tess4j -- although it could've been that tess4j has already fixed the problem.

Generally speaking: don't put stuff in profiles.clj unless you actually want it for every profile (by putting it in user). Instead: create a separate profile, maybe add an alias so that lein tesser ... is actually lein with-profile tesser tesser ....

Either way, closing because not a caesium bug.

@lvh Sure!

And hey thanks, this has been a learning experience for me 😄

Actually, could you please elaborate more on that transitive dependency - I didn't quite get it. If you could just point me to some other resource, that'd be fine as well.

commented

Looks like lept4j is also maintained by the same person, both repos on github: https://github.com/nguyenq/lept4j

commented

The problem is not that tess4j depends on a bad version of asm; the problem is that tess4j depends on lept4j depends on rococoa-core depends on cglib depends on a bad version of asm. Hence, not a direct dependency, but a transitive dependency. So, try to find the library that can't reasonably make a dependency optional or replace it or upgrade it (one of lept4j, rococoa-core, cglib), file a bug (this time with a fully contained source example), try to eventually end up with a release of cglib that uses a recent version of asm, then upgrade up the chain.

Ah, I see. Thanks 👍