noir-clojure / noir-cljs

A noir utility to add ClojureScript compilation through middleware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trouble getting started, possibly jar issue?

mariusk opened this issue · comments

I followed the instructions to get it running, but every time it complained about "missing Var cljs.core/defn" and many similar issues for other var. Since this project consist of one simple clj file, I simply copied the content of the file into my own project, and then it runs just fine. I have no idea why I am having so much trouble with the using this module by referring to the jar in the project file, but thought I would post here in case others are struggling.

I confirmed that starting from scratch this works. So I suspect this is an issue with something getting cached incorrectly. If you remove lib and do lein clean, lein deps does it work? Other things to look into would be removing ~/.m2/repository/noir-cljs/, which will force it to redownload from clojars when you do lein deps.

I had the same issue. It seems like it will compile correctly some times, but not work the next time.

I had other issues, so mine may not be a clean example.

Did some more testing; unable to connect the dots. I did clean the m2 repo and all the other stuff, but it does not change anything. But there is also no difference between pulling in the jar through the project file, or including the source file in my own project. If there is any cljs that needs to be compiled it will fail on startup. If I move any cljs file into the source directory after it successfully started up (meaning without any cljs to be compiled) and I try to reload a page (to trigger auto recompile), it fails in the same way when calling build. The ouput (with my diag showing what build gets fed) is:

Starting server...
src-dir: src/ opts: {:output-dir "resources/public/cljs/", :output-to "resources/public/cljs/bootstrap.js", :optimizations :simple}
WARNING: Use of undeclared Var cljs.core/defn at line 15
WARNING: Use of undeclared Var cljs.core/truth_ at line 15
WARNING: Use of undeclared Var cljs.core/x at line 15

and many similar lines. So it seems to be something in the clojurescript methods themselves, and not related to noir-cljs. I have no idea how/why others get this stuff working.

Can you email me a zip of your project with the libs and classes folders included?

On 08/14/2011 09:15 PM, ibdknox wrote:

Can you email me a zip of your project with the libs and classes folders included?

Thank your for trying to help. Github email wasn't too happy about a 15
megabyte email, so I've put it up here instead:

http://kjeldahl.net/myapp.tbz

Thanks,

Marius K.

On 08/14/2011 09:15 PM, ibdknox wrote:

Can you email me a zip of your project with the libs and classes folders included?

I just realized the version I sent you was with your source file in my
project/namespace. I packed up the version that pulls in your jar at:

http://kjeldahl.net/myapp2.tbz

Thanks,

Marius K.

So I definitely got the error running it exactly how you sent it to me. I changed it back to noir-cljs and did lein clean, rm -rf lib/, lein deps and it worked.

It seems like maybe you have a bad version of the goog-jar, cljs-compiler-jar, or noir-cljs somewhere, either that or some .class file is sticking around when it shouldn't be. To be safe, you could remove classes/ too.

On 08/14/2011 10:10 PM, ibdknox wrote:

So I definitely got the error running it exactly how you sent it to me. I changed it back to noir-cljs and did lein clean, rm -rf lib/, lein deps and it worked.

It seems like maybe you have a bad version of the goog-jar, cljs-compiler-jar, or noir-cljs somewhere, either that or some .class file is sticking around when it shouldn't be. To be safe, you could remove classes/ too.

Yeah, I've tried it all. Removed lib, class, even my local maven repo
(~/.m2). Also verified that I do not have a classpath pointing to
anywhere else. Nothing. But it still fails like I described. I'll keep
digging and let you know if I figure it out..

Thanks,

Marius K.

There's definitively something fishy if you are not having any issues. I
tested a clean install on another computer, but the same OS (Update
Ubuntu Natty 11.04 x64), and I get the exact same problem on that
machine. So I doubt it's something hanging around, rather something
either not compiling properly, or something wrong getting pulled in
consistently.

Thanks,

Marius K.

On 08/14/2011 10:10 PM, ibdknox wrote:

So I definitely got the error running it exactly how you sent it to me. I changed it back to noir-cljs and did lein clean, rm -rf lib/, lein deps and it worked.

It seems like maybe you have a bad version of the goog-jar, cljs-compiler-jar, or noir-cljs somewhere, either that or some .class file is sticking around when it shouldn't be. To be safe, you could remove classes/ too.

Any chance you could zip up your working copy, so I could compare what
versions etc are being pulled in at your end?

Thanks,

Marius K.

On 08/14/2011 10:10 PM, ibdknox wrote:

So I definitely got the error running it exactly how you sent it to me. I changed it back to noir-cljs and did lein clean, rm -rf lib/, lein deps and it worked.

It seems like maybe you have a bad version of the goog-jar, cljs-compiler-jar, or noir-cljs somewhere, either that or some .class file is sticking around when it shouldn't be. To be safe, you could remove classes/ too.

Here you go: http://thisink.com/assets/uploads/myapp.zip

My next question, what version of the JDK are you running?

On 08/15/2011 07:49 PM, ibdknox wrote:

Here you go: http://thisink.com/assets/uploads/myapp.zip

My next question, what version of the JDK are you running?

java -version outputs:

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

Thanks,

Marius K.

On 08/15/2011 07:49 PM, ibdknox wrote:

Here you go: http://thisink.com/assets/uploads/myapp.zip

Thanks. The jars look identical (as expected), but the class files have
lots of differences (also expected, based on differences in JDK and
platforms; you're on Mac, I'm on Linux).

Funnily enough, your compiled version does not fail at my end.
Considering I've tested this on multiple computers now, I fear it might
be some minute differences regarding the platforms, where things work on
Mac (which most of you guys use I guess), but worst case not on
"straight up" Ubuntu linux...

Thanks,

Marius K.

Are you sure you're using the sun JDK? That's the only thing I can think of, because I've had this working on ubuntu too.

update-java-alternatives -l
update-java-alternatives -s java-6-sun

On 08/15/2011 08:56 PM, ibdknox wrote:

Are you sure you're using the sun JDK? That's the only thing I can think of, because I've had this working on ubuntu too.

update-java-alternatives -l
update-java-alternatives -s java-6-sun

Yes, I'm sure.

This is what update-alternatives outputs:

  • 2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

pluss:

marius@marius-Latitude-E6400:$ which java
/usr/bin/java
marius@marius-Latitude-E6400:
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2011-07-24 19:21 /usr/bin/java ->
/etc/alternatives/java
marius@marius-Latitude-E6400:$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 36 2011-07-24 19:21 /etc/alternatives/java ->
/usr/lib/jvm/java-6-sun/jre/bin/java
marius@marius-Latitude-E6400:
$ java -version

Very annoying.

Thanks,

Marius K.

By this time I am getting very suspicious; found this thread:

http://code.google.com/p/googleappengine/issues/detail?id=4712

Are you running 1.6.0_24 by any chance, and could it be that that
version on OSX is generating bad code?

Grasping for straws...

Thanks,

Marius K.

On 08/15/2011 08:56 PM, ibdknox wrote:

Are you sure you're using the sun JDK? That's the only thing I can think of, because I've had this working on ubuntu too.

update-java-alternatives -l
update-java-alternatives -s java-6-sun

On 08/15/2011 10:08 PM, Marius Kjeldahl wrote:

Are you running 1.6.0_24 by any chance, and could it be that that
version on OSX is generating bad code?

Eh, read that as generating incompatible code...

Thanks,

Marius K.

I'm on 1.2.0_26

Cheers,
Chris.

On Mon, Aug 15, 2011 at 1:38 PM, mariusk <
reply@reply.github.com>wrote:

On 08/15/2011 10:08 PM, Marius Kjeldahl wrote:

Are you running 1.6.0_24 by any chance, and could it be that that
version on OSX is generating bad code?

Eh, read that as generating incompatible code...

Thanks,

Marius K.

Reply to this email directly or view it on GitHub:
https://github.com/ibdknox/noir-cljs/issues/3#issuecomment-1810754

If you get this issue,

delete all of the class files in your project

"find . -name "*.class" -exec rm {} ;"

restart

This seems to work.