Thanks, Alex, I will give this a try the next time I run into this. Given a 
little distance from the problem, and the insights that you and Mars0i have 
been sharing, I have a clearer picture of what was going on at compile 
time. I suspect the problem is something along these lines: Leiningen 
invokes the compiler on the file that is supposed to create my class, and 
it fails because of my incorrect ordering of function invocation and 
definition. For reasons unknown, but which if I can pin down better I will 
open as an issue with Leiningen, the output from this failed compilation is 
lost. Then when something tries tor refer to the class which was supposed 
to have been compiled and fails, the linkage error happens.

But now that you have pointed me at a way to just invoke the compiler 
directly on my problem source file, I bet I will be able to see the 
compilation errors when I do that, which will enable me to fix them without 
trial and error. 

Indeed, I just tested that by commenting out one of the functions in my 
source, confirming that Leiningen gives me the cryptic linkage error, and 
tried a manual compile from the REPL, and was given this completely helpful 
compilation error:
 

afterglow.max.core=> (compile 'afterglow.max.Metro)

CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
set-bar in this context, compiling:(afterglow/max/Metro.clj:121:7) 


So the next time I screw up, I will be able to figure out how.

Thanks, everyone! Perhaps I should open a Leiningen issue about this now.

Cheers,

  -James

On Monday, August 3, 2015 at 9:59:57 AM UTC-5, Alex Miller wrote:
>
> You can just use the clojure.core/compile function to compile. There is a 
> simple example at http://clojure.org/compilation.  
>
> I have not seen or experienced a linkage error like this before and I'm 
> not aware of any ticket like this. Generally a linkage error indicates you 
> are seeing the wrong version of a class loaded by a different classloader.
>
>
> On Monday, August 3, 2015 at 9:47:10 AM UTC-5, James Elliott wrote:
>>
>> Wow, that is a challenge, Alex! I would have no idea how to even compile 
>> a project without Leiningen. If I ever am not using 200% of my free time 
>> working on these projects, I may try to research that. I am afraid it may 
>> be some time, though. I was just hoping this was a known issue with know 
>> solutions.
>>
>> Thanks,
>>
>>   -James
>>
>> On Aug 3, 2015, at 09:41, Alex Miller <al...@puredanger.com> wrote:
>>
>> If you can create a small, reproducible test case (that does not require 
>> Leiningen), please file a ticket.
>>
>> On Monday, August 3, 2015 at 9:27:47 AM UTC-5, James Elliott wrote:
>>>
>>> Indeed, I visited the page you cite while trying to pin down this 
>>> problem. However, I am fairly certain that in my case it is a weird side 
>>> effect, not a root cause: I get that message when compiling my Clojure file 
>>> if I try to call a function which is defined later in the file. If I move 
>>> the function definition up before the point where I was calling it, 
>>> everything compiles fine, and no linkage error. No library changes in 
>>> between the two tests. And this only happens when my Clojure file is 
>>> subclassing a Java object. Very, very strange...
>>>
>>> On Monday, August 3, 2015 at 12:27:38 AM UTC-5, Mars0i wrote:
>>>>
>>>> I don't have anything helpful to say, but:  I've often gotten a useful 
>>>> stacktrace from compile-time errors using 'lein compile' with :gen-class.  
>>>> Not always.  Sometimes I have to use the guess-and-comment-out method.  So 
>>>> I think that whatever's happening is not just an issue with compilation of 
>>>> gen-class.  Maybe an issue involving libraries?  This page 
>>>> <http://examples.javacodegeeks.com/java-basics/exceptions/java-lang-unsatisfiedlinkerror-how-to-handle-unsatisfied-link-error/>
>>>>  
>>>> is consistent with that hypothesis.
>>>>
>>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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 a topic in the 
>> Google Groups "Clojure" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/clojure/yONboCAt-UA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> clojure+u...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
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.

Reply via email to