I've been trying to get ANTLR 2.7.4 to run under Cygwin with GCJ. After trying to piece information together, I've finally found a recipe that makes it work.
ANTLR comes with a standard
./configure script. Under Cygwin, it executes fine, but during compilation, there is an error related to AWT in directory
base/antlr/debug/misc. AWT seems to be a JAVA standard library.
A previous article shows how to work around the error, but it didnít solve everything for me: I was able to create a
libantlr.so file (see step 4 of that page), but step 5 broke down, probably because some things in my path weren't set correctly (I think). Step 5 relies on a file called
antlr/Tool.class, which doesn't exist in the
./antlr directory but in the
antlr.jar file instead (a jar file is a tar-like library in which .class files can be gathered.)
In the end, I got it to work by un-jarring all the files and simply bypassing the creation of a shared library.
Here's what I did: (
basedir is the directory where you can find ./configure)
./configure --prefix=install dir. While we do not need to configure to compile the antlr executable, we do need it to compile the support C++ libraries. Do NOT run make after configure!
rm -fr misc
jar xfv antlr.jar
gcj --main=antlr.Tool `find antlr -name "*.class"` -o cantlr
If all is well, you will see a bunch of warnings on your screen that, I assume, you can safely ignore. The end result is a file called
./cantlr). You should see a bunch of lines with program information.
./src directory will contain a file called
libantlr.a. Now install the library and include files to the place that was originally indicated during the
A set of C++ files will now be generated.