[antlr-interest] Linking against the C runtime.

dario.damico at damix.it dario.damico at damix.it
Sat Sep 22 18:38:01 PDT 2012


The same happens when compiling for i386, like in:

    gcc -lantlr3c -arch i386 SimpleCalcParser.c SimpleCalcLexer.c

Then I found the solution proposed by Shinji Nakamatsu in:

    http://www.antlr.org/wiki/display/ANTLR3/Five+minute+introduction+to+ANTLR+3

Sorry, I didn't see that comment before.

Dario

---------- Original Header -----------

From      : antlr-interest-bounces at antlr.org
To          : antlr-interest at antlr.org
Cc          : 
Date      : Sun, 23 Sep 2012 02:56:21 +0200
Subject : [antlr-interest] Linking against the C runtime.

> Hi everybody, I have a problem linking against the C runtime for ANTLR. I'm using the following software:
> 
>   Operating system: Mac OS X 10.7.4 
>   ANTLRWorks+ANTLR: Version 1.4.3 - for Windows, Linux and Mac OS X
>   ANTLR C Runtime : libantlr3c-3.4.tar.gz
> 
> I installed the runtime like this:
>   ./configure --enable-64bit
>   make
>   sudo make install
> 
> I used ANTLRWorks to generate lexer and parser for a grammar; I obtained
> 2 .c files and 2 .h files. I tried to compile them like this:
> 
>   gcc -lantlr3c SimpleCalcParser.c SimpleCalcLexer.c
> 
> But I got this error:
> 
>   SimpleCalcParser.c: In function ‘main’:
>   SimpleCalcParser.c:347: warning: assignment makes pointer from integer without a cast
>   Undefined symbols for architecture x86_64:
>     "_antlr3AsciiFileStreamNew", referenced from:
>         _main in cc4epMVA.o
>   ld: symbol(s) not found for architecture x86_64
>   collect2: ld returned 1 exit status
> 
> If I build the library WITHOUT the --enable-64bit flag, the error looks even worse:
> 
>   SimpleCalcParser.c: In function ‘main’:
>   SimpleCalcParser.c:347: warning: assignment makes pointer from integer without a cast
>   ld: warning: ignoring file /usr/local/lib/libantlr3c.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
>   Undefined symbols for architecture x86_64:
>     "_antlr3ParserNewStream", referenced from:
>         _SimpleCalcParserNewSSD in ccTJEO4M.o
>     "_antlr3AsciiFileStreamNew", referenced from:
>         _main in ccTJEO4M.o
>     "_antlr3CommonTokenStreamSourceNew", referenced from:
>         _main in ccTJEO4M.o
>     "_antlr3LexerNewStream", referenced from:
>         _SimpleCalcLexerNewSSD in ccC9Aeuk.o
>   ld: symbol(s) not found for architecture x86_64
>   collect2: ld returned 1 exit status
> 
> In these emails, http://www.antlr.org/pipermail/antlr-interest/2010-September/039702.html a problem similar to mine was reported, and was completely solved by adding the --enable-64bit flag.
> 
> Any idea? Thanks for your help.
> 
> Dario
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 



More information about the antlr-interest mailing list