[antlr-interest] Problems compiling with C target with example

DR JAYMAHDI dr.jaymahdi at gmail.com
Tue May 11 11:58:29 PDT 2010


I am currently having some problems compiling the C target example based on
this famous link:
which I found very useful. I have some problems however, trying to
properly compile this using g++ since the targeted C code will be used for
my C++ development.

I basically copied/pasted the code (as verbatim) from that webpage into the
Antlrworks 3.2 (just released today). The C runtime library file I used is:
libantlr3c-3.2.tar.gz. I followed the instructions listed here (
http://www.antlr.org/api/C/build.html) and did a ./configure --enable-64bit
since I am using a 64bit OS. I generated the parser files from the
Antlrworks, as expected. I did a compile gcc *.c -lantlr3c -o parser_example
which produced no errors.

However, as I tried ./parser_example, it gave me the message "error while
loading shared libraries: libantlr3c.so: cannot open shared object file: No
such file or directory". I was able to locate the libantlr3c.so which was in
my /usr/local/lib directory. So I created a symbolic link using sudo ln -s
/usr/local/lib libantlr3c.so into my /usr/lib directory. Problem slightly
solved but now I have a segmentation fault everytime I run ./parser_example

I did not modify the generated parser files in anyway to cause this problem.
So I am not sure why it is accessing the wrong memory address location.

So if someone could please help me with this (hopefully simple?) problem,
it'll be greatly appreciated.

Thanks in advanced,


More information about the antlr-interest mailing list