[antlr-interest] building antlr 3.1b1

Hamilton Link helink at sandia.gov
Thu May 22 19:48:16 PDT 2008


Hamilton Link wrote:
> I do have ANT 1.7 and JDK 1.6 installed but when I tried to
> "ant build" the 3.1b1 distribution I got a mess of errors.

OK, I can build 3.1b1 from the distro now.  For those of you who are 
Java-illiterate like me, let me briefly clarify a few things:

- In general when compiling java stuff you want to pass javac a 
-classpath argument enumerating the jar files of interest, don't set a 
CLASSPATH variable for your entire shell (usually).

- If you're building it under Mac OS X or *nix, your classpath separator 
character is ':' and under windows it is ';' --- and annoyingly, using a 
';' under OS X doesn't error out, it just... ignores the classpath 
you're providing, so you get "package so.and.so does not exist" errors 
for stuff you thought you pointed to.

- Less obviously, to build antlr 3.1b1, you need one jar beyond what
http://www.antlr.org/wiki/pages/viewpage.action?pageId=732
says (and note the comment added one beyond what the original page 
had).  Your classpath must include the following four jar files:

${ANTLRLIB}/antlr-2.7.7.jar
${ANTLRLIB}/stringtemplate-3.1.jar
${ANTLRLIB}/junit-4.4.jar
${ANTLRLIB}/antlr-runtime-3.1b1.jar

- And no, junit-4.4.jar is not provided in the distribution, you need to 
get it from sourceforge.  gunit's not the same thing (as it turns out).

- And there's no such thing as org/antlr/*/*/*.java in the distribution 
(presumably because we're provided the jar files instead), so I am 
setting an ANTLR_CP variable to the above list and compiling with the 
following command within antlr-3.1b1/src:

javac -verbose -classpath ${ANTLR_CP} -d . org/antlr/Tool.java 
org/antlr/*/*.java


Now that I can do this much, we'll see if I can rebuild targets, .net 
runtime assemblies, or the jar files provided in antlr-3.1b1/lib.  I am 
guessing not, as there appears to be code to these jar files that 
doesn't come with the snapshots.  Perhaps someone in the know can 
clarify what having the snapshots (vs. the exhaustive sources) does and 
does not let us build from scratch?

I think, also, that it would be friendly if someone could go and update 
the "how to rebuild antlr" web page at 
http://www.antlr.org/wiki/pages/viewpage.action?pageId=732  ... it's not 
hugely out of date but it is a little bit out of date, and it would be 
nice if that page made it clear what you are rebuilding and what you 
can't rebuild without additional code not provided in the snapshots.

thanks,
h




More information about the antlr-interest mailing list