This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug libgcj/30570] Word "DEBUG" used as a variable in VMAccessController.java breaks build
- From: "rob1weld at aol dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 8 Feb 2007 20:56:32 -0000
- Subject: [Bug libgcj/30570] Word "DEBUG" used as a variable in VMAccessController.java breaks build
- References: <bug-30570-13830@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from rob1weld at aol dot com 2007-02-08 20:56 -------
I found out exactly what the trouble is - it _likely_ affects ALL platforms.
I use a very long set of configure options (to enable as much as possible) but
the one that is causing the trouble is: --enable-libgcj-debug .
I proved this by altering the file:
gcc-4_2-branch/libjava/java/security/natVMAccessController.cc
I added this around the "#include <config.h>" statement:
static const jint DEBUG = 1L;
#include <config.h>
static const jint DEBUG = 1L;
I then compiled the file using the exact same command that make shows on screen
plus I added "-E" to show the error and examined the resulting file:
# 11
"/cygdrive/C/makecygwin/gcc-4_2-branch/libjava/java/security/natVMAccessController.cc"
static const jint DEBUG = 1L;
# 1 "./include/config.h" 1
# 14
"/cygdrive/C/makecygwin/gcc-4_2-branch/libjava/java/security/natVMAccessController.cc"
2
static const jint 1 = 1L;
The second 'jint' statement is wrong so that means that the included "config.h"
wrecked things.
Looking at file:
"/gcc-4_2-branch-build/i686-pc-cygwin/libjava/include/config.h"
we have this:
/* include/config.h. Generated by configure. */
/* include/config.h.in. Generated from configure.ac by autoheader. */
/* Define this if you want runtime debugging enabled. */
#define DEBUG 1
Note: We have the same definition (without causing the error, since _this_
"config.h" is not included) here in
"/gcc-4_2-branch-build/i686-pc-cygwin/libjava/classpath/include/config.h".
/* include/config.h. Generated by configure. */
/* include/config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you want native library runtime debugging code enabled */
#define DEBUG 1
That second one does not cause any trouble but _IF_ you are going to change the
word "DEBUG" be sure to change them both if they should both be the same word.
This problem comes from the file: /gcc-4_2-branch/libjava/include/config.h.in
so this _IS_ a 'gcc problem' and not a problem with either classpath's source
or Cygwin's headers. Here is the part of config.h.in at fault:
/* include/config.h.in. Generated from configure.ac by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define this if you want runtime debugging enabled. */
#undef DEBUG
/* Define if system properties shouldn't be read from
getenv("GCJ_PROPERTIES"). */
#undef DISABLE_GETENV_PROPERTIES
Now that _MAY_ seem inocent enough but what happens when you run
"/gcc-4_2-branch/configure --enable-libgcj-debug" is that
"/gcc-4_2-branch/libjava/configure" gets passed the "--enable-libgcj-debug" and
creates a "confdefs.h" file (that gets deleted - thus hiding the problem from
searching).
When the "/gcc-4_2-branch/libjava/configure" script gets near the end it does
the "sed script routine" (to substitute variables in the "*.in" files) it uses
the confdefs.h file as well.
Here is the part of the configure script that says it does this:
# Transform confdefs.h into two sed scripts, `conftest.defines' and
# `conftest.undefs', that substitutes the proper values into
# config.h.in to produce config.h. The first handles `#define'
# templates, and the second `#undef' templates.
That tells me that configure is replacing the "#undef DEBUG" in "config.h.in"
with "#define DEBUG 1" if configure uses the parameter "--enable-libgcj-debug".
This creates the problem in the "java/security/VMAccessController.h" file that
is made by gcjh (I hope I explained that correctly).
I just got through re-running /gcc-4_2-branch/configure (with all my long list
of parameters) without using "--enable-libgcj-debug" and make runs without
causing the error (while compiling
gcc-4_2-branch/libjava/java/security/natVMAccessController.cc) it still breaks
_elsewhere_ ;( .
I am not an expert on Java and I will leave it to the experts as how best to
fix this. My 2 cents is that the file /gcc-4_2-branch/libjava/configure is
wrong since it sets "#define DEBUG 1" ; and in doing so it breaks the file
java/security/VMAccessController.h (created by gcjh). I suggest that this is
_equally_ applicable to _all_ platforms and would halt the build for anyone who
uses "--enable-libgcj-debug" (_AND_ also uses other parameters that cause
/gcc-4_2-branch/libjava/java/security/natVMAccessController.cc to be compiled).
Since this should happen on any platform can someone else confirm it?
(As a point of interest I am using this /gcc-4_2-branch/configure command:
/cygdrive/C/makecygwin/gcc-4_2-branch/configure --disable-werror --verbose
--target=i686-pc-cygwin --enable-languages=c,ada,c++,fortran,java,objc,obj-c++
--prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-static --enable-nls --enable-multilib
--with-included-gettext --enable-version-specific-runtime-libs
--enable-checking
--with-gxx-include-dir=/usr/include/c++/4.2.0 --enable-concept-checks
--enable-sjlj-exceptions --enable-libstdcxx-debug --enable-libgcj
--enable-libgcj-debug --enable-java-awt=gtk,xlib --enable-java-gc=boehm
--enable-gconf-peer --enable-hash-synchronization --enable-gc-debug
--enable-interpreter --enable-xmlj --enable-qt-peer --enable-regen-headers
--enable-tool-wrappers --enable-objc-gc --with-system-zlib
--enable-threads=posix
--enable-libada --enable-libssp --enable-libmudflap --enable-win32-registry
--with-x --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
--with-cpu=athlon-xp --with-arch=athlon-xp --with-tune=athlon-xp
).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30570