gcj && libjava for cygwin

Billinghurst, David (CRTS) David.Billinghurst@riotinto.com
Wed Apr 18 08:03:00 GMT 2001


OK.  I have duplicated this, with a couple of variations on the way.  
 *  a couple more patches below
 * -lpthreads are defined by configure.in.  Will submit patch for this
 * I think Ican work around IP6 issues 
 * WinMain@16 problem comes from linking -lcygwin to early

What I don't understand where _Jv_Sjlj_Throw and JNI_OnLoad are defined.  


Needed one strncasecmp in gcc/java/parse.c (or more correctly parse.y)

--- parse.c.orig        Tue Apr 17 23:55:39 2001
+++ parse.c     Wed Apr 18 19:47:12 2001
@@ -6026,7 +6026,8 @@
        ;
       if (f[0] == '/' || f[0] == DIR_SEPARATOR)
        f++;
-      if (strncmp (IDENTIFIER_POINTER (raw_name),
+      /* DB CYGWIN */
+      if (strncasecmp (IDENTIFIER_POINTER (raw_name),
                   f , IDENTIFIER_LENGTH (raw_name)) ||
          f [IDENTIFIER_LENGTH (raw_name)] != '.')
        parse_error_context

In libjava/java/lang/natSystem.cc

--- natSystem.cc.orig   Tue Apr 17 23:23:23 2001
+++ natSystem.cc        Wed Apr 18 20:58:19 2001
@@ -265,7 +265,11 @@
   // issue exists in java/util/natGregorianCalendar.cc.
   tzoffset = 0L;
 #endif
+#ifdef __CYGWIN__
+  tzinfo = _tzname;
+#else
   tzinfo = tzname;
+#endif

   if ((tzoffset % 3600) == 0)
     tzoffset = tzoffset / 3600; 

> -----Original Message-----
> From:	Robert Collins [SMTP:robert.collins@itdomain.com.au]
> Sent:	Monday, April 16, 2001 4:33 PM
> To:	java@gcc.gnu.org; cygwin-apps@sources.redhat.com
> Subject:	gcj && libjava for cygwin
> 
> 
> Well it's a lot further along than it was... I'm going to have to leave
> it alone for now... so here's the current status:
> 
> Part 1: for java@gcc.gnu.org..
> 
> Hi, the attached patch should be acceptable for committing to the gcc
> tree. (The two line hack I sent to java@gcc.gnu.org to prevent parsing
> files twice is still needed, I'll clean that up as previously discussed
> once I get some feedback on the best method). The patch fixes a couple
> of minor compile time issues.
> 
> I also found that cygwin's ip6 support isn't complete enough for
> libjava. Someone interested can either rework libjava or extend cygwin,
> but I won't be attempting that.
> 
> As configure found IP6 support, I edited
> $(top_builddir)/i686-pc-cygwin/libjava/include/config.h and undef'd the
> IP6 defines that configure found.
> 
> 
> Rob.
> 
> Part 2: for cygwin-apps.
> 
>  I copied this to the cygwin-apps list for any cygwin porters interested
> in picking up the ball and running with it (I don't have the time, and
> with no java projects it doesn't make much sense to offer ;] ).
> If you want to test this do the following:
> grab gcc 3 from CVS (not head, get the gcc 3 branch.
> 
> Configure it as per http://gcc.gnu.org/java/build-snapshot.html . Cygwin
> uses threads=posix as per that page. DONT SKIP STEP 4. GCJ is disabled
> for cygwin by default.
> before building:
> Apply the patch from http://gcc.gnu.org/ml/java/2001-04/msg00260.html .
> This is not a final patch, but it will fix the issue on cygwin (unless
> you use case_check:strict.).
> Apply the patch from this email.
> Edit the config.h file referenced above and disable the IP6 defines.
> 
> edit i686-pc-cygwin/libjava/config.stats remove the two references
> to -lpthread (incorrectly detected - I haven't looked into why yet).
> in i686-pc-cygwin/libjava run ./config.status
> ditto for boehm-gc
> 
> then carry on with the rest of step 5.
> It dies on the final link of jv-convert.exe:
> 
> /usr/src/gcc3/build/gcc/gcj -B/usr/src/gcc3/build/i686-pc-cygwin/libjava
> / -B/usr/src/gcc3/
> build/gcc/ -ffloat-store -g -O2 -o
> jv-convert.exe --main=gnu.gcj.convert.Convert -shared-l
> ibgcc gnu/gcj/convert/BytesToUnicode.o gnu/gcj/convert/Convert.o
> gnu/gcj/convert/Input_885
> 9_1.o gnu/gcj/convert/Input_ASCII.o gnu/gcj/convert/Input_EUCJIS.o
> gnu/gcj/convert/Input_J
> avaSrc.o gnu/gcj/convert/Input_SJIS.o gnu/gcj/convert/Input_UTF8.o
> gnu/gcj/convert/Input_i
> conv.o gnu/gcj/convert/IOConverter.o gnu/gcj/convert/Output_8859_1.o
> gnu/gcj/convert/Outpu
> t_ASCII.o gnu/gcj/convert/Output_EUCJIS.o
> gnu/gcj/convert/Output_JavaSrc.o gnu/gcj/convert
> /Output_SJIS.o gnu/gcj/convert/Output_UTF8.o
> gnu/gcj/convert/Output_iconv.o gnu/gcj/conver
> t/UnicodeToBytes.o  -L/usr/src/gcc3/build/i686-pc-cygwin/libjava
> ../.libs/libgcj.a -L/usr/s
> rc/gcc3/build/i686-pc-cygwin/libstdc++-v3/src -L/usr/src/gcc3/build/i686
> -pc-cygwin/libstdc
> ++-v3/src/.libs -L/usr/lib/w32api/ -L/usr/src/gcc3/build/gcc -L/usr/lib/
> mingw -lgcc -lcygw
> in -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc
> ../../boehm-gc/.libs/libgcjgc.a -L/usr/sr
> c/gcc3/build/i686-pc-cygwin/libjava/../boehm-gc/.libs
> ../../zlib/.libs/libzgcj.a -L/usr/src
> /gcc3/build/i686-pc-cygwin/libjava/../zlib/.libs -L/usr/src/gcc3/build/i
> 686-pc-cygwin/libj
> ava/.libs -Wl,--rpath -Wl,/usr/src/gcc3/install/lib
> ../.libs/libgcj.a(natClass.o)(.text$_ZN4java4lang5ClassC1Ev+0x0):
> multiple definition of `j
> ava::lang::Class::Class()'
> ../.libs/libgcj.a(Class.o)(.text+0x3a0): first defined here
> /cygdrive/e/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccZRJIDimain%O(.text+0x0):
> multiple definition
>  of `main'
> /usr/lib/libcygwin.a(libcmain.o)(.text+0x0): first defined here
> gnu/gcj/convert/BytesToUnicode.o(.text+0x252): undefined reference to
> `_Jv_Sjlj_Throw'
> gnu/gcj/convert/BytesToUnicode.o(.text+0x5e1): undefined reference to
> `_Jv_Sjlj_Throw'
> gnu/gcj/convert/UnicodeToBytes.o(.text+0x252): undefined reference to
> `_Jv_Sjlj_Throw'
> gnu/gcj/convert/UnicodeToBytes.o(.text+0x5e1): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(System.o)(.text+0x3df): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(StringBuffer.o)(.text+0x508): more undefined references
> to `_Jv_Sjlj_Thro
> w' follow
> ../.libs/libgcj.a(SimpleTimeZone.o)(.data+0x0):SimpleTimeZone.java:
> undefined reference to
> `Jv_byteVTable'
> ../.libs/libgcj.a(StringTokenizer.o)(.text+0x3a3): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(BasicPermission.o)(.text+0x99): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(BasicPermission.o)(.text+0x32d): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(BasicPermission.o)(.text+0x3b5): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(BufferedReader.o)(.text+0x2ed): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(BufferedReader.o)(.text+0xdb1): more undefined
> references to `_Jv_Sjlj_Th
> row' follow
> ../.libs/libgcj.a(natFirstThread.o)(.text+0xfb): undefined reference to
> `JNI_OnLoad'
> ../.libs/libgcj.a(natFirstThread.o)(.text+0x11a): undefined reference to
> `JNI_OnLoad'
> ../.libs/libgcj.a(Vector.o)(.text+0x6e): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Vector.o)(.text+0x1fe): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Vector.o)(.text+0x271): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Vector.o)(.text+0x89f): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Vector.o)(.text+0xabf): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Vector.o)(.text+0xba1): more undefined references to
> `_Jv_Sjlj_Throw' fol
> low
> ../.libs/libgcj.a(GregorianCalendar.o)(.data+0x0):GregorianCalendar.java:
> undefined referen
> ce to `Jv_intVTable'
> ../.libs/libgcj.a(GregorianCalendar.o)(.data+0x60): undefined reference
> to `Jv_intVTable'
> ../.libs/libgcj.a(GregorianCalendar.o)(.data+0xc0): undefined reference
> to `Jv_intVTable'
> ../.libs/libgcj.a(SimpleDateFormat.o)(.text+0x9cf): undefined reference
> to `_Jv_Sjlj_Throw'
> 
> ../.libs/libgcj.a(SimpleDateFormat.o)(.text+0x3939): undefined reference
> to `_Jv_Sjlj_Throw
> '
> ../.libs/libgcj.a(DateFormat.o)(.text+0x21a): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(DateFormat.o)(.text+0x3cd): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(DateFormat.o)(.text+0x6a6): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Stack.o)(.text+0xa1): more undefined references to
> `_Jv_Sjlj_Throw' follo
> w
> ../.libs/libgcj.a(ZipEntry.o)(.data+0x0): undefined reference to
> `Jv_shortVTable'
> ../.libs/libgcj.a(ZipFile.o)(.text+0x119): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(ZipFile.o)(.text+0x44b): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(ZipFile.o)(.text+0x479): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(ZipFile.o)(.text+0x6f9): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(ZipFile.o)(.text+0x79e): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(ZipFile.o)(.text+0x81e): more undefined references to
> `_Jv_Sjlj_Throw' fo
> llow
> ../.libs/libgcj.a(InetAddress.o)(.data+0x0): undefined reference to
> `Jv_byteVTable'
> ../.libs/libgcj.a(Socket.o)(.text+0x5d4): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Socket.o)(.text+0x7b9): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Socket.o)(.text+0x8f1): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Socket.o)(.text+0xb08): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(Socket.o)(.text+0xc09): undefined reference to
> `_Jv_Sjlj_Throw'
> ../.libs/libgcj.a(URLConnection.o)(.text+0x40e): more undefined
> references to `_Jv_Sjlj_Thr
> ow' follow
> /usr/lib/libcygwin.a(libcmain.o)(.text+0x6a): undefined reference to
> `WinMain@16'
> 
> I'm at a loss at this point. There are two apparent issues to me: the
> duplicate defined class IMO is likely related to the missing symbols.
> The WinMain@16 shouldn't be turning up unless the linker is getting
> seriously confused. Also the inclusion of mingw in the library search
> path is worrying. So consider a chunk of research done, a few problems
> solved, and this doco for the next adventurer.
> 
> Remarks: Once everything is compiling and linkking, you _may_ hit an
> issue with classes not being found or something similar. My java here
> has a bunch of strcmp on filenames converted to strcasecmp. I don't
> believe that will affect the functionality - changing them didn't fix
> the fault with the Paint class. However changing them _may_ have fixed
> fault I would have run into later. My recommendation: don't change them
> unless you can pinpoint them as a bug. (Cygwin is case preserving and
> thus shouldn't need strcasecmp for most things.)
> Secondly, the X client includes may be needed to build libjava properly.
> I don't know if they are , cause I have them :]
> 
> P.S. As I don't program java I have no idea of the type or amount of
> bugs hiding in the background. Have fun!
> 
> Rob << File: libjava.patch >> 



More information about the Java mailing list