I've experienced the same problem (long list of undeclared vars) on OS
X (10.6.8), with JDK version 1.6.0.26 and 1.6.0.22, when I tried to
call the cljs.closure/build function out of a Ring/Compojure web
application.

Then I tested on Ubuntu 11.04 in VirtualBox, just trying to compile a
*.cljs file out of the REPL, everything worked for me.

Java version on Ubuntu:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)

Here are the steps I followed:
1) Create a new project:
> lein new cljstest

2) Added dependencies to project.clj
(defproject cljstest "1.0.0-SNAPSHOT"
            :description "FIXME: write description"
            :dependencies [[org.clojure/clojure "1.3.0-beta2"]
                          [cljs-compiler-jar "0.1.0-SNAPSHOT"]
                          [goog-jar "1.0.0"]])

3) Resolve dependencies: "lein deps"

4) Created a simple ClojureScript test file in src/test.cljs
(defn hello-world [msg]
  (println msg))

(hello "world")

5) Repl launched: "lein repl"

6) In the REPL, did
user=> (use 'cljs.closure)
nil
user=> (build "src/test.cljs" {:output-dir "./", :output-to
"./test-compiled.js", :optimizations :simple})
nil
user=>

It seems the problem is not connected to the Java/JDK version in my
case, since downgrading to 1.6.0.22 didn't solve the problem.

I'll do some more testing and keep you updated on my results.

Raju


On Wed, Aug 17, 2011 at 10:05 PM, kjeldahl
<mariusauto-googlegro...@kjeldahl.net> wrote:
> I have another data point to add to my testing regarding this problem.
> Defining a pretty minimal little clojure test program:
>
> (ns cljstest.main
>  (:require [cljs.closure :as closure]))
>
> (defn -main [& m]
>  (closure/build "src/mycljs/hello.cljs" {:optimizations :simple
>                                          :output-dir "out/"
>                                          :output-to "out/
> bootstrap.js"})
>  (println "Hello world."))
>
> Running this with "lein run" fails as I've described earlier in this
> thread. For the hell of it, I removed all the compiled code in the
> "classes" dir, and simply started a java repl in the same dir, with
> the same classpath leiningen would use EXCEPT I removed the "classes"
> part, and then inside the repl run:
>
> (use 'cljstest.main)
> (-main)
>
> Then everything works just fine. It definitively looks like something
> is wonky in the clojurescript compiler that requires it to run in some
> kind of repl environment (or depends on some kind of sideeffect of the
> repl environment).
>
> Thanks,
>
> Marius K.
>
> --
> 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 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

Reply via email to