[antlr-interest] Working recipe to build antlr in Cygwin environment

Terence Parr parrt at cs.usfca.edu
Sun Nov 30 14:17:59 PST 2003


I have fixed the website so your recipe is hosted properly :)

Terence

On Wednesday, November 26, 2003, at 11:24 PM, Ashish Aggarwal wrote:

> Hi terence,
>   I tried to "add article" titled "Working recipe to build Antlr on 
> Cygwin". But, i failed to upload the corresponding html page corres. 
> to it.
> Please let me know how to do it. Else, if possible, you upload the 
> attached HTML page there.
>
> I hope this will really help a lot of antlr-users to get rid of 
> installation problems.
>
> Best Regards
> Ashish
>
> Terence Parr wrote:
>
> Hi Ashish, looks great!  Do you want to upload to antlr.org under
> articles?  Just hit the "add article" button. :)
>
> Also, I can upload a PC binary of ANTLR if you want to the download
> page. :)  Just email it to me.
>
> Terence
>
> On Monday, November 24, 2003, at 07:44 PM, Ashish Aggarwal wrote:
>
>
>
> Hi frends,
>    As every new user do face problems in building antlr on windows,
> using cygwin/java/gcc, I (on behalf of our company, atrenta) , would
> like to share with you all this working recipe on "How To Build Antlr
> On Cygwin".
>
> If any one of you have any suggestion for modifications in it, do let
> me know.
> Else, I would like the owner of this group , Terence, to kindly put
> the same on the website www.antlr.org
>
> Cheers
> Ashish
>
> #######################################################################
> #####
> Here is the working recipe, repeated until it works exactly from a
> clean install every time with no redo
> Environment:
> Windows 2000:
>
> cygwin:
> 1.5.5.1
>  which has problems with gcc and cpp (and configure fails with)
> mingw :
> MinGW-3.1.0-1.exe
> (do not forget to rename make.exe to mingw32-make.exe, as it cannot
> cope with the ANTLR Makefile!, but the cygwin one can)
>
> path in cygwin to use mingw first
> PATH="/mingw/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
>
> java SDK:
> j2sdk-1_4_2-nb-3_5_1-bin-windows.exe
>
> antlr:
> antlr-2.7.2.tar.gz
>
> 1.Untar anltr into a new directory under cygwin <basedir>
> {mine is C:\cygwin\redo\antlr-2.7.2, under cycgwin its
> /redo/antlr-2.7.2}
> Do NOT add antlr.jar  to your $CLASSPATH environment, as it is not a
> valid file yet.
>
> 2. Note that <basedir>/configure contains an error at
> # Java
>
> CLASSPATH=$CLASSPATH:.
>  just comment it out, as we set the . in the external CLASSPATH
> #CLASSPATH=$CLASSPATH:.
>
> 3. set up class path for configure
>  note the . in the path
>         the ; path seperator
>         the windows file format.
>       These are because Java j2sdk is a windows application, not a
> cygwin application
> export CLASSPATH=".;c:\cygwin\j2sdk1.4.2\lib"
>
> $ echo $CLASSPATH
> .;c:\cygwin\j2sdk1.4.2\lib
>
> 3. cd <basedir>
>    run configure as
> ./configure --prefix=<basedir>
> with base dir in windows format
>
> $ ./configure --prefix=/redo/antlr-2.7.2
> ...
> configure: creating ./config.stat
> cconfigure: creating ./config.status
> config.status: creating scripts/Config.make
> config.status: creating scripts/antlr-config
> config.status: creating scripts/run-antlr
> $
>
>
> 4. cd scripts & edit the Config.make just created to put the correct
> class path in
> # Programs we might use and their options...
> # next line commented
> #ANTLR    = $(JAVA) -cp $(TOPDIR)/antlrall.jar antlr.Tool
> ANTLR    = $(JAVA) -cp "C:\cygwin\redo\antlr-2.7.2" antlr.Tool
>
>
> 5. clear $CLASSPATH (not set it to blank, that does NOT work)
> unset CLASSPATH
>
> 6. build with NO Classpath
> make
>
> $ make
> =============================
> Making dependencies...
> =============================
> make[1]: Entering directory `/redo/antlr-2.7.2/antlr'
> ...
> ===========================================
> Making antlr.jar...
> ===========================================
> ===========================================
> Making antlr.debug.jar...
> ===========================================
> Building antlr/ANTLRTokdefLexer.java
> Building antlr/ANTLRTokdefParser.java
> Note: antlr/ANTLRTokdefParser.java uses or overrides a deprecated API.
> Note: Recompile with -deprecation for details.
> Building antlr/actions/cpp/ActionLexer.java
> Building antlr/actions/java/ActionLexer.java
> Building antlr/preprocessor/Preprocessor.java
> Note: antlr/preprocessor/Preprocessor.java uses or overrides a
> deprecated API.
> Note: Recompile with -deprecation for details.
> Building antlr/preprocessor/PreprocessorLexer.java
> ===========================================
> Making antlrall.jar...
> ===========================================
>
> 7. Make install with NO Classpath
> make install
>
> $ make install
> Installing jar files into /redo/antlr-2.7.2/share/antlr-2.7.2
> ...
> Installing config.hpp into /redo/antlr-2.7.2/include/antlr
> make[3]: Leaving directory `/redo/antlr-2.7.2/lib/cpp/antlr'
> make[2]: Leaving directory `/redo/antlr-2.7.2/lib/cpp'
> make[1]: Leaving directory `/redo/antlr-2.7.2/lib'
>
> 8. check in antlr-2.7.2/lib for libantlr.a
>
> 9. set up class path to run
> $ export
> CLASSPATH=".;c\cygwin\j2sdk1.4.2\lib;C:\cygwin\redo\antlr-
> 2.7.2\antlrall.jar"
>
> 10. create test directory
> $ mkdir grammars
> $ cp examples/cpp/*/*.g grammars
> $ cd grammars
>
> 11. test
> $antlr calc.g
>
> Check for the hpp & cpp files in grammars
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>
> --
> Professor Comp. Sci., University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Co-founder, http://www.jguru.com
> Co-founder, http://www.knowspam.net enjoy email again!
> Co-founder, http://www.peerscope.com pure link sharing
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
>
>
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>
>
>
> Here is the working recipe, repeated until it works exactly from a 
> clean install every time with no redo.
>
>  
>
> Environment:
>
>
>
> Windows 2000:
>
>
>
> cygwin:1.5.5.1, which has problems with gcc and cpp (and configure 
> fails with)
>
>  
>
> Mingw:MinGW-3.1.0-1.exe
>
> (do not forget to rename make.exe to mingw32-make.exe, as it cannot
>
> cope with the ANTLR Makefile!, but the cygwin one can)
>
>
>
> path in cygwin to use mingw first
>
> PATH="/mingw/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
>
>
>
> java SDK:
>
> j2sdk-1_4_2-nb-3_5_1-bin-windows.exe
>
>
>
> antlr:
>
> antlr-2.7.2.tar.gz
>
>
>
> STEPS TO BUILD:
>
>
>
> 1.Untar anltr into a new directory under cygwin <basedir>
>
> {mine is C:\cygwin\redo\antlr-2.7.2, under cycgwin its 
>
> /redo/antlr-2.7.2}
>
> Do NOT add antlr.jar  to your $CLASSPATH environment, as it is not a 
>
> valid file yet.
>
>
>
> 2. Note that <basedir>/configure contains an error at
>
> # Java
>
>
>
> CLASSPATH=$CLASSPATH:.
>
>  just comment it out, as we set the. in the external CLASSPATH
>
> #CLASSPATH=$CLASSPATH:.
>
>
>
> 3. set up class path for configure
>
>  note the. in the path
>
>         the ; path seperator
>
>         the windows file format.
>
>       These are because Java j2sdk is a windows application, not a
>
> cygwin application
>
> export CLASSPATH=".;c:\cygwin\j2sdk1.4.2\lib"
>
>
>
> $ echo $CLASSPATH
>
> .;c:\cygwin\j2sdk1.4.2\lib
>
>
>
> 3. cd <basedir>
>
>    run configure as
>
> ./configure --prefix=<basedir>
>
> with base dir in windows format
>
>
>
> $ ./configure --prefix=/redo/antlr-2.7.2
>
> ...
>
> configure: creating ./config.stat
>
> cconfigure: creating ./config.status
>
> config.status: creating scripts/Config.make
>
> config.status: creating scripts/antlr-config
>
> config.status: creating scripts/run-antlr
>
> $
>
>
>
>
>
> 4. cd scripts & edit the Config.make just created to put the correct
>
> class path in
>
> # Programs we might use and their options...
>
> # next line commented
>
> #ANTLR    = $(JAVA) -cp $(TOPDIR)/antlrall.jar antlr.Tool
>
> ANTLR    = $(JAVA) -cp "C:\cygwin\redo\antlr-2.7.2" antlr.Tool
>
>
>
>
>
> 5. clear $CLASSPATH (not set it to blank, that does NOT work)
>
> unset CLASSPATH
>
>
>
> 6. build with NO Classpath
>
> make
>
>
>
> $ make
>
> =============================
>
> Making dependencies...
>
> =============================
>
> make[1]: Entering directory `/redo/antlr-2.7.2/antlr'
>
> ...
>
> ===========================================
>
> Making antlr.jar...
>
> ===========================================
>
> ===========================================
>
> Making antlr.debug.jar...
>
> ===========================================
>
> Building antlr/ANTLRTokdefLexer.java
>
> Building antlr/ANTLRTokdefParser.java
>
> Note: antlr/ANTLRTokdefParser.java uses or overrides a deprecated API.
>
> Note: Recompile with -deprecation for details.
>
> Building antlr/actions/cpp/ActionLexer.java
>
> Building antlr/actions/java/ActionLexer.java
>
> Building antlr/preprocessor/Preprocessor.java
>
> Note: antlr/preprocessor/Preprocessor.java uses or overrides a
>
> deprecated API.
>
> Note: Recompile with -deprecation for details.
>
> Building antlr/preprocessor/PreprocessorLexer.java
>
> ===========================================
>
> Making antlrall.jar...
>
> ===========================================
>
>
>
> 7. Make install with NO Classpath
>
> make install
>
>
>
> $ make install
>
> Installing jar files into /redo/antlr-2.7.2/share/antlr-2.7.2
>
> ...
>
> Installing config.hpp into /redo/antlr-2.7.2/include/antlr
>
> make[3]: Leaving directory `/redo/antlr-2.7.2/lib/cpp/antlr'
>
> make[2]: Leaving directory `/redo/antlr-2.7.2/lib/cpp'
>
> make[1]: Leaving directory `/redo/antlr-2.7.2/lib'
>
>
>
> 8. check in antlr-2.7.2/lib for libantlr.a
>
>
>
> 9. set up class path to run
>
> $ export 
>
> CLASSPATH=".;c\cygwin\j2sdk1.4.2\lib;C:\cygwin\redo\antlr-
>
> 2.7.2\antlrall.jar"
>
>
>
> 10. create test directory
>
> $ mkdir grammars
>
> $ cp examples/cpp/*/*.g grammars
>
> $ cd grammars
>
>
>
> 11. test
>
> $antlr calc.g
>
>
>
> Check for the hpp & cpp files in grammars
>
>  
>
>  
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list