[Fwd: Help Needed - Trying to Build GCJ/MinGW]

Ranjit Mathew rmathew@hotmail.com
Thu Aug 22 16:51:00 GMT 2002


Hi,

     I originally posted this message to the "mingw-users"
mailing list, but I feel the GCJ developers would be
able to shed more light on this issue. Any help would
be greatly appreciated. The original message is attached
at the end of this mail.

The errors at which I'm stuck are contained in the following
output in the GCC3.2/GCJ build process:
-------------------------------- 8< ------------------------------
...
make[2]: Entering directory `/c/gcc3.2/build/mingw32/libjava'
/c/gcc3.2/build/gcc/gcj -B/c/gcc3.2/build/mingw32/libjava/ 
-B/c/gcc3.2/build/gcc/ --encoding=UTF-8 -C -g -classpath '' 
-bootclasspath /c/gcc3.2/build/mingw32/libjava:/c/gcc3.2/gcc-3.2/libjava \
              -d /c/gcc3.2/build/mingw32/libjava 
/c/gcc3.2/gcc-3.2/libjava/java/lang/Class.java
c:\gcc3.2\gcc-3.2\libjava\java\lang\Class.java:30: Public class 
`java.lang.Class' must be defined in a file called `Class.java'.
    public final class Class implements Serializable
                       ^
c:\gcc3.2\gcc-3.2\libjava/gnu/java/security/provider/gnu.java:42: Class 
`gnu.java.security.provider.Gnu' already defined in 
c:\gcc3.2\gcc-3.2\libjava/gnu/java/security/provider/Gnu.java:42.
    public final class Gnu extends Provider
                       ^
c:\gcc3.2\gcc-3.2\libjava/gnu/java/security/provider/gnu.java:45: 
confused by earlier errors, bailing out
make[2]: *** [java/lang/Class.class] Error 1
make[2]: Leaving directory `/c/gcc3.2/build/mingw32/libjava'
...
-------------------------------- 8< ------------------------------

Thanks a lot for your help in advance!

Ranjit.

-------- Original Message --------
Subject: Help Needed - Trying to Build GCJ/MinGW
Date: Wed, 21 Aug 2002 12:13:02 +0530
From: Ranjit Mathew <rmathew@hotmail.com>
Newsgroups: gmane.comp.gnu.mingw.user

Hi,

      As mentioned earlier, I'm trying to get GCJ/MinGW
working with GCC 3.2. I could get a build (after some
tweaks) of GCJ, but without libgcj - so it was not
terribly useful. But then, building libgcj itself is
now giving me all sorts of problems (details follow).

I would request you guys, especially Danny and Earnie if
possible, to verify my "tweaks" and suggest the Right
Way to do them and Adam to (please!) help me get
unstuck from these libgcj errors.

Brad ("b.l. baker") might want to repeat my steps to see
if he has any better luck.

I'm using gcc 2.95.3-6, binutils (2.13), w32api (1.5)
and mingw-runtime (2.1). I'm using MSYS 1.0.7 as the
build environment.

First off, I got the official FSF GCC 3.2 sources and
applied the "gcc-3.2-20020817-1-src.diff.gz" patches.
I guess the alternative patched archive
"gcc-3.2-20020817-1-src.tar.gz" is equally valid.

I unpacked it to "c:\gcc3.2\gcc-3.2" and used
"c:\gcc3.2\build" as the build folder.

Though done during several attempts to compile the beast,
the essential steps to get it going seem to be to
do the following first (all done in the "build" folder from
within the MSYS shell):

1. Configured the GCC 3.2 build process. Issued the command:

/c/gcc3.2/gcc-3.2/configure --prefix=/mingw --with-gnu-as --with-gcc
--with-gnu-ld --enable-threads --disable-nls
--enable-languages=c,c++,java --disable-win32-registry --disable-shared
--oldincludedir=/mingw/include --host=mingw32 --build=mingw32
--target=mingw32 --enable-libgcj

(Earnie, the --oldincludedir option did not resolve my
problem of missing standard include files, but the --prefix
option did. But that would mean my original MinGW installation
would be overwritten, which is not an exciting thought. Any
idea why exactly is it like that? Why can't I install to
an alternative location?)

NOTE: --enable-languages=java, implies that C++, and therefore
C, is also built. So you can't have a "pure" GCJ I guess.

2. Patched the 'gcc/Makefile' file (around line 71) to read:

BOOT_CFLAGS = -g0 -O2

(missing hyphen before "g0" in the original file)

3. Patched '../gcc-3.2/fastjar/jartool.c', line 437, to read:

                     S_IRUSR | S_IWUSR );

(removed S_IRGRP and S_IROTH. Why aren't they in MinGW stat.h?)

4. Patched '../gcc-3.2/fastjar/jartool.c', line 1427, to read:

          if(mkdir(tmp_buff) < 0){

(removed "extra" access mode arg. to mkdir.)

5. Patched '../gcc-3.2/fastjar/dostime.c', line 111, to read:

    time_t clock = time((void *)0);

(changed NULL to (void *)0, which is an equivalent form.)

6. Downloaded libregex from

     http://sourceforge.net/projects/mingwrep/

     and unpacked into the original MinGW folder so
     that regex.h and libregex.a are accessible.

(this is now a part of glibc, but not apparently that shipped
with MinGW.)

7. Patched 'fastjar/Makefile', line 148 to read:

LIBS = -lregex -lmingwex

(libmingwex.a now defines opendir(), etc. which are not
available in MSVCRT. libregex.a is needed by fastjar.)

8. Added these lines to '../gcc-3.2/gcc/gthr.h', after line 89:

#elif _WIN32_THREADS
#include "gthr-win32.h"

(This *should* have been there, IMO!)

9. Patched 'gcc/Makefile', line 273 to read:

GTHREAD_FLAGS=-D_WIN32_THREADS

(so that the modification in Step 8 is effective.)

10. Ran "make bootstrap". This takes quite some time
on my box here (Win2K/SP2, PIII/700MHz, 256MB RAM).

(ATTN: Adam)
After (quite) some time I get errors about missing ".d"
files for certain Java classes (e.g.
java.awt.image.AreaAveragingScaleFilter, java.text.Annotation,
java.rmi.dgc.DGC, etc.).

I examined the other ".d" files and found all of them
to be single byte files with 0x0A. This looks very weird
and probably indicates a major SNAFU, but I just copied
other ".d" files into the missing files and continued
with the build.

And now I get really weird errors about public classes
not being defined in files named after them. For example:

c:\gcc3.2\gcc-3.2\libjava\java\lang\Class.java:30: Public class
`java.lang.Class' must be defined in a file called `Class.java'.
     public final class Class implements Serializable

This is weird because, as you can see, the class 'Class' is
of course being defined in a file named 'Class.java'. Ditto
for other classes like gnu.java.security.provider.Gnu, etc.

So I have some SNAFU from which I must wriggle out somehow and
any help is appreciated here! I'll try to take this struggle
up again some time, work permitting.

Finally, apologies for this really long mail, but I felt I must
describe my steps to verify that I'm not doing something patently
silly.

Sincerely Yours,
Ranjit Mathew.
(rmathew@hotmail.com)


-- 
Ranjit Mathew                    E-Mail: rmathew@hotmail.com

Member (Technical Staff),        Phone:  +91-80-5216767 x350
Elind Computers Private Limited,
Bangalore, INDIA.                http://ranjitmathew.tripod.com/





More information about the Java mailing list