antlr/antlr3

Building the C runtime in a git clone

okellogg opened this issue · 0 comments

Hi,

The INSTALL instructions and the ANTLR3C: Building From Source page assume that the configure script exists, which is not the case when building from a git clone.

Here is how I managed to build antlr3 runtime/C on an x86_64 system running current OpenSuSE Tumbleweed:

  • Applied the patch to runtime/C/Makefile.am shown below.
    Reason: automake was complaining about the source files being in
    the src subdirectory with option subdir-objects disabled.
  • Executed the following Linux commands:
    autoheader
    aclocal
    libtoolize
    automake --add-missing --copy
    autoconf
    ./configure --enable-64bit

At the ./configure I did need the --enable-64bit argument, otherwise I would get

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -Iinclude -m32 -O2 -Wall -MT src/antlr3baserecognizer.lo -MD -MP -MF src/.deps/antlr3baserecognizer.Tpo -c src/antlr3baserecognizer.c -o src/antlr3baserecognizer.o
In file included from /usr/include/features.h:452,
                 from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from include/antlr3defs.h:252,
                 from include/antlr3baserecognizer.h:39,
                 from src/antlr3baserecognizer.c:9:
/usr/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: No such file or directory
 # include <gnu/stubs-32.h>
           ^~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:645: src/antlr3baserecognizer.lo] Error 1

Here is the patch to Makefile.am that I used:

diff --git a/runtime/C/Makefile.am b/runtime/C/Makefile.am
index 9867f7e..d7cba2a 100644
--- a/runtime/C/Makefile.am
+++ b/runtime/C/Makefile.am
@@ -1,4 +1,4 @@
-AUTOMAKE_OPTIONS = gnu
+AUTOMAKE_OPTIONS = subdir-objects
 AM_LIBTOOLFLAGS =
 ## --silent
 ACLOCAL_AMFLAGS = -I m4