[antlr-interest] Linking against the C runtime.

Jim Idle jimi at temporal-wave.com
Sun Sep 23 17:04:55 PDT 2012


This:

antlr3AsciiFileStreamNew

Is not the correct function to call for that version of ANTLR. Downloading
the latest examples should show you the new function.

Jim

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of dario.damico at damix.it
Sent: Sunday, September 23, 2012 8:56 AM
To: antlr-interest at antlr.org
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