Hi everyone Yesterday I proudly announced my new Wiki engine; today I'm investigating an odd bug which prevents it compiling on some Ubuntu machines, but not my laptop (on which I did the development), and I'm really puzzled by it.
Top level outline: When one clones the repository from https://github.com/simon-brooke/smeagol.git and then invokes lein repl (or lein ring uberwar, lein ring server, and so on) one gets an odd bug. If one does simple 'lein repl', one gets an error message '#<CompilerException java.lang.IllegalAccessError: lu does not exist, compiling:(ring/middleware/format_response.clj:1:1)>'; if one then does smeagol.repl=> (ns smeagol.repl #_=> (:use smeagol.handler #_=> ring.server.standalone #_=> [ring.middleware file-info file])) one gets CompilerException java.lang.IllegalAccessError: lu does not exist, compiling:(ring/middleware/format_response.clj:1:1) If one instead does lein ring server one gets a full stacktrace, which I'll append at the end of this post. However, the diagnosis as far as I've got goes like this: The file ring/middleware/format_response.clj <https://github.com/ngrunwald/ring-middleware-format/blob/master/src/ring/middleware/format_response.clj> starts with this expression: (ns ring.middleware.format-response (:require [cheshire.core :as json] [ring .util.response :as res] [clojure.java.io :as io] [clj-yaml.core :as yaml] [ clojure.string :as s] [cognitect.transit :as transit]) (:use [clojure.core. memoize :only [lu]]) (:import [java.io File InputStream BufferedInputStream ByteArrayOutputStream] [java.nio.charset Charset])) I've highlighted the sub-expression I'm suspicious of. Looking at clojure/core/memoize.clj <https://github.com/clojure/core.memoize/blob/master/src/main/clojure/clojure/core/memoize.clj>, there is both '(def-deprecated lu ...)' (line 373) and '(defn lu ...)' (line 384). I'm not sure what is going on there, and I'm even more confused that the deprecation comment says (def-deprecated lu "DEPRECATED: Please use clojure.core.memoize/lu instead." Given that this is in the namespace clojure.core.memoize, that comment doesn't make sense to me - I'm obviously missing something. My guess that the namespace clojure.core.memoize should be provided by the jar clojure-1.6.0.jar seems to be correct: simon@fletcher:~/workspace/smeagol$ jar tvf /home/simon/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar | grep memoize 1055 Tue Mar 25 08:45:06 GMT 2014 clojure/core$memoize.class 1708 Tue Mar 25 08:45:06 GMT 2014 clojure/core$memoize$fn__5097.class On both the machines on which Smeagol works, and on the machines on which Smeagol does not work, the file size of clojure.1.0.jar is 3664472 bytes and the MD5 sum is fdbad523e92cb53e61484106431d4489, so it's not the case that I've got different versions of Clojure. Likewise the filesize of /home/simon/.m2/repository/ring-middleware-format/ring-middleware-format/0.4.0/ring-middleware-format-0.4.0.jar is 14366 bytes and the MD5 sum is 38b9850a38bd9ee5eb3321c73cada73c both on working and on non working installations. I've pulled the source for ring-middleware-format from https://github.com/ngrunwald/ring-middleware-format.git - it compiles without complaint (but is a slightly later version than the 0.4.0 build, it's 0.4.1-SNAPSHOT). Oh, and (having made a backup, fortunately) I've done a 'lein clean; lein ring server' on my development machine and established that it now also has the bug. There is literally nothing that is not either in the git-ignore file or else in git. In short, I'm stuck and puzzled. I don't think this is my bug, but I'm prepared to believe it could be. I don't understand why the bug appears in a clean checkout, but doesn't occur in my development directory. I'm not yet confident enough that it's someone else's bug to post an issue on their repository. Any help you can give would be extremely welcome! My .git-ignore is as follows: smeagol.log pom.xml pom.xml.asc *jar /lib/ /classes/ /target/ /checkouts/ /resources/public/content/.git .lein-deps-sum .lein-repl-history .lein-plugins/ .lein-failures .lein-env My project.clj is as follows: (defproject smeagol "0.2.0-SNAPSHOT" :description "A simple Git-backed Wiki inspired by Gollum" :url "http://example.com/FIXME" :dependencies [[org.clojure/clojure "1.6.0"] [lib-noir "0.9.4" :exclusions [org.clojure/core.memoize org.clojure/tools.reader]] [ring-server "0.3.1"] [selmer "0.7.2"] [com.taoensso/timbre "3.3.1" :exclusions [org.clojure/tools.reader]] [com.taoensso/tower "3.0.2" :exclusions [com.taoensso/encore]] [markdown-clj "0.9.55" :exclusions [com.keminglabs/cljx]] [clj-jgit "0.8.1"] [environ "1.0.0"] [im.chit/cronj "1.4.2"] [noir-exception "0.2.2"] [prone "0.6.0"]] :repl-options {:init-ns smeagol.repl} :jvm-opts ["-server"] :plugins [[lein-ring "0.8.13" :exclusions [org.clojure/clojure]] [lein-environ "1.0.0"] [lein-ancient "0.5.5" :exclusions [org.clojure/clojure org.clojure/data.xml]] [lein-marginalia "0.7.1" :exclusions [org.clojure/clojure]]] :ring {:handler smeagol.handler/app :init smeagol.handler/init :destroy smeagol.handler/destroy} :profiles {:uberjar {:omit-source true :env {:production true} :aot :all} :production {:ring {:open-browser? false :stacktraces? false :auto-reload? false}} :dev {:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.3.1"] [pjstadig/humane-test-output "0.6.0"]] :injections [(require 'pjstadig.humane-test-output) (pjstadig.humane-test-output/activate!)] :env {:dev true}}} :min-lein-version "2.0.0") Full stack trace: simon@fletcher:~/workspace/smeagol$ lein ring server Exception in thread "main" java.lang.IllegalAccessError: lu does not exist, compiling:(ring/middleware/format_response.clj:1:1) at clojure.lang.Compiler.load(Compiler.java:7142) at clojure.lang.RT.loadResourceScript(RT.java:370) at clojure.lang.RT.loadResourceScript(RT.java:361) at clojure.lang.RT.load(RT.java:440) at clojure.lang.RT.load(RT.java:411) at clojure.core$load$fn__5066.invoke(core.clj:5641) at clojure.core$load.doInvoke(core.clj:5640) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5446) at clojure.core$load_lib$fn__5015.invoke(core.clj:5486) at clojure.core$load_lib.doInvoke(core.clj:5485) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5528) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:626) at clojure.core$require.doInvoke(core.clj:5607) at clojure.lang.RestFn.invoke(RestFn.java:408) at ring.middleware.format$eval1014$loading__4958__auto____1015.invoke(format.clj:1) at ring.middleware.format$eval1014.invoke(format.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6703) at clojure.lang.Compiler.eval(Compiler.java:6692) at clojure.lang.Compiler.load(Compiler.java:7130) at clojure.lang.RT.loadResourceScript(RT.java:370) at clojure.lang.RT.loadResourceScript(RT.java:361) at clojure.lang.RT.load(RT.java:440) at clojure.lang.RT.load(RT.java:411) at clojure.core$load$fn__5066.invoke(core.clj:5641) at clojure.core$load.doInvoke(core.clj:5640) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5446) at clojure.core$load_lib$fn__5015.invoke(core.clj:5486) at clojure.core$load_lib.doInvoke(core.clj:5485) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5524) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:628) at clojure.core$use.doInvoke(core.clj:5618) at clojure.lang.RestFn.invoke(RestFn.java:805) at noir.util.middleware$eval1008$loading__4958__auto____1009.invoke(middleware.clj:1) at noir.util.middleware$eval1008.invoke(middleware.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6703) at clojure.lang.Compiler.eval(Compiler.java:6692) at clojure.lang.Compiler.load(Compiler.java:7130) at clojure.lang.RT.loadResourceScript(RT.java:370) at clojure.lang.RT.loadResourceScript(RT.java:361) at clojure.lang.RT.load(RT.java:440) at clojure.lang.RT.load(RT.java:411) at clojure.core$load$fn__5066.invoke(core.clj:5641) at clojure.core$load.doInvoke(core.clj:5640) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5446) at clojure.core$load_lib$fn__5015.invoke(core.clj:5486) at clojure.core$load_lib.doInvoke(core.clj:5485) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5524) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:626) at clojure.core$require.doInvoke(core.clj:5607) at clojure.lang.RestFn.invoke(RestFn.java:1789) at smeagol.handler$eval935$loading__4958__auto____936.invoke(handler.clj:18) at smeagol.handler$eval935.invoke(handler.clj:18) at clojure.lang.Compiler.eval(Compiler.java:6703) at clojure.lang.Compiler.eval(Compiler.java:6692) at clojure.lang.Compiler.load(Compiler.java:7130) at clojure.lang.RT.loadResourceScript(RT.java:370) at clojure.lang.RT.loadResourceScript(RT.java:361) at clojure.lang.RT.load(RT.java:440) at clojure.lang.RT.load(RT.java:411) at clojure.core$load$fn__5066.invoke(core.clj:5641) at clojure.core$load.doInvoke(core.clj:5640) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5446) at clojure.core$load_lib$fn__5015.invoke(core.clj:5486) at clojure.core$load_lib.doInvoke(core.clj:5485) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5524) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:626) at clojure.core$require.doInvoke(core.clj:5607) at clojure.lang.RestFn.invoke(RestFn.java:457) at user$eval5.invoke(form-init5099686921962551806.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6703) at clojure.lang.Compiler.eval(Compiler.java:6692) at clojure.lang.Compiler.load(Compiler.java:7130) at clojure.lang.Compiler.loadFile(Compiler.java:7086) at clojure.main$load_script.invoke(main.clj:274) at clojure.main$init_opt.invoke(main.clj:279) at clojure.main$initialize.invoke(main.clj:307) at clojure.main$null_opt.invoke(main.clj:342) at clojure.main$main.doInvoke(main.clj:420) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:383) at clojure.lang.AFn.applyToHelper(AFn.java:156) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) Caused by: java.lang.IllegalAccessError: lu does not exist at clojure.core$refer.doInvoke(core.clj:3919) at clojure.lang.RestFn.applyTo(RestFn.java:139) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_lib.doInvoke(core.clj:5505) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:626) at clojure.core$load_libs.doInvoke(core.clj:5524) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:628) at clojure.core$use.doInvoke(core.clj:5618) at clojure.lang.RestFn.invoke(RestFn.java:408) at ring.middleware.format_response$eval1020$loading__4958__auto____1021.invoke(format_response.clj:1) at ring.middleware.format_response$eval1020.invoke(format_response.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6703) at clojure.lang.Compiler.eval(Compiler.java:6692) at clojure.lang.Compiler.load(Compiler.java:7130) ... 98 more Subprocess failed -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.