public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Compiling libgjc under cygwin
@ 2001-07-03 11:34 Julian Hall
  2001-07-03 15:31 ` Robert Collins
  2001-07-04 11:23 ` Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: Julian Hall @ 2001-07-03 11:34 UTC (permalink / raw)
  To: cygwin, java

Hi; I know that for the moment this is unsupported but I'm trying to get
libgjc from the gcc-3.0 distribution to compile in a cygwin environment.

I've figured out the following:

- I've looked at win32-threads.cc and the threads porting documentation,
and guess from the looks of it that it should work OK as distributed (?)

- I modified configure so that it would recognise gcc's win32 thread
model and choose win32-threads.cc
- The resulting makefile had java.awt packages that failed to compile,
so I simply removed all of the awt and related sources.  I think the
compilation errors here were due to the case-insensitivity of the file
system: they were effectively errors about duplicate class definitions
in (eg) image.java and Image.java.
- java/util/natGregorianCalendar.cc wasn't compiling correctly; I had to
forcibly undefine HAVE_TIMEZONE to persuade it to work, as the
definition of 'timezone' it used was incompatible with the cygwin
definition.
- Fastjar required patching in order to function correctly; the patch I
applied is attached, and simply causes files to be opened with the
O_BINARY flag if it is defined.

However, I am still faced with compile errors when it comes to linking
the utilitty programs that are part of the library; the errors
specifically are:

./.libs/libgcj.a(natClass.o): In function `ZN4java4lang5Class4sizeEv':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/lang/Class.h(.text$_ZN4java4lang5ClassC1Ev+0x0):
multiple definition of `java::lang::Class::Class()'
./.libs/libgcj.a(Class.o):/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/lang/Class.java:168:
first defined here
./.libs/libgcj.a(win32-threads.o): In function
`Z18_Jv_ThreadInitDataPN4java4lang6ThreadE':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/win32-threads.cc:129:
undefined reference to `operator new(unsigned)'
./.libs/libgcj.a(win32-threads.o): In function
`Z21_Jv_ThreadDestroyDataP12_Jv_Thread_t':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/win32-threads.cc:138:
undefined reference to `operator delete(void*)'
./.libs/libgcj.a(natFirstThread.o): In function
`ZN3gnu3gcj7runtime11FirstThread3runEv':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/gnu/gcj/runtime/natFirstThread.cc:60:
undefined reference to `JNI_OnLoad'
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/gnu/gcj/runtime/natFirstThread.cc:68:
undefined reference to `JNI_OnLoad'
./.libs/libgcj.a(SimpleTimeZone.o)(.data+0x0):SimpleTimeZone.java:
undefined reference to `Jv_byteVTable'
./.libs/libgcj.a(ZipEntry.o): In function
`ZN4java4util3zip8ZipEntryC1EPNS_4lang6StringE':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/util/zip/ZipEntry.java:65:
undefined reference to `Jv_shortVTable'
./.libs/libgcj.a(GregorianCalendar.o)(.data+0x0):GregorianCalendar.java:
undefined reference to `Jv_intVTable'
./.libs/libgcj.a(GregorianCalendar.o): In function
`ZN4java4util17GregorianCalendarC1EPNS0_8TimeZoneE':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/util/GregorianCalendar.java:100:
undefined reference to `Jv_intVTable'
./.libs/libgcj.a(GregorianCalendar.o): In function
'ZN4java4util17GregorianCalendarC1EPNS0_8TimeZoneEPNS0_6LocaleE':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/util/GregorianCalendar.java:113:
undefined reference to `Jv_intVTable'
./.libs/libgcj.a(InetAddress.o): In function
`ZN4java3net11InetAddressC1EP6JArrayIcEPNS_4lang6StringE':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/net/InetAddress.java:74:
undefined reference to `Jv_byteVTable'
./.libs/libgcj.a(natInflater.o): In function
`ZN4java4util3zip8Inflater3endEv':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/util/zip/natInflater.cc:53:
undefined reference to `inflateEnd'
./.libs/libgcj.a(natInflater.o): In function
`ZN4java4util3zip8Inflater7inflateEP6JArrayIcEii':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/util/zip/natInflater.cc:107:
undefined reference to `inflate'
./.libs/libgcj.a(natInflater.o): In function
`ZN4java4util3zip8Inflater5resetEv':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/util/zip/natInflater.cc:151:
undefined reference to `inflateReset'
./.libs/libgcj.a(natInflater.o): In function
`ZN4java4util3zip8Inflater13setDictionaryEP6JArrayIcEii':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/gcj/array.h:46:
undefined reference to `inflateSetDictionary'
./.libs/libgcj.a(natInflater.o): In function
`ZN4java4util3zip8Inflater4initEb':
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/java/util/zip/natInflater.cc:200:
undefined reference to `inflateInit2_'
collect2: ld returned 1 exit status

I've also tried configuring the entire system with
--enable-threads=posix, but gcc is unable to compile correctly if I do
this.

Any ideas what needs to be done to solve these problems?

Oh, and thanks for producing such great products; I've been using cygwin
under windows for quite a while and have just started with gcj under
linux and like the results so far! Great work.

Jules

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling libgjc under cygwin
  2001-07-03 11:34 Compiling libgjc under cygwin Julian Hall
@ 2001-07-03 15:31 ` Robert Collins
  2001-07-04 11:23 ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Collins @ 2001-07-03 15:31 UTC (permalink / raw)
  To: Julian Hall, cygwin, java

----- Original Message -----
From: "Julian Hall" <jules@acris.co.uk>
To: <cygwin@cygwin.com>; <java@gcc.gnu.org>
Sent: Wednesday, July 04, 2001 4:39 AM
Subject: Compiling libgjc under cygwin


> Hi; I know that for the moment this is unsupported but I'm trying to get
> libgjc from the gcc-3.0 distribution to compile in a cygwin environment.

What target do you have (win32/mingw | cygwin | unix*) ?

> I've figured out the following:
>
> - I've looked at win32-threads.cc and the threads porting documentation,
> and guess from the looks of it that it should work OK as distributed (?)

Ah, no. Cygwin != win32. On cygwin, to ensure that fork() and fork()
dependant calls work properly I strongly recommend the use of pthreads. Some
serious bugs and have been corrected recently so they should :} be working
fine. Speed wise they are now comparable to the win32-pthreads library.

win32 threads _may_ work, but no guarantees.

> - I modified configure so that it would recognise gcc's win32 thread
> model and choose win32-threads.cc
> - The resulting makefile had java.awt packages that failed to compile,
> so I simply removed all of the awt and related sources.  I think the
> compilation errors here were due to the case-insensitivity of the file
> system: they were effectively errors about duplicate class definitions
> in (eg) image.java and Image.java.

There were patches posted by me and another cygwinner whose name escapes me
(sorry!) about 4-5 months ago. Search for cygwin in the java list archives.
I go the filename issues fixed at that point. Unfortunately the patches
weren't really ready for integration - they would likely have destabilised
unix platforms. Some enthusatic cygwin + java person probably needs to hop
on and stay on the java list.

> - java/util/natGregorianCalendar.cc wasn't compiling correctly; I had to
> forcibly undefine HAVE_TIMEZONE to persuade it to work, as the
> definition of 'timezone' it used was incompatible with the cygwin
> definition.

There are patches that dont' require breaking unix for this.

> - Fastjar required patching in order to function correctly; the patch I
> applied is attached, and simply causes files to be opened with the
> O_BINARY flag if it is defined.

I don't think we had tackled that (bin mounts were used) - thanks for the
patches.

> However, I am still faced with compile errors when it comes to linking
> the utilitty programs that are part of the library; the errors
> specifically are:
>
> ./.libs/libgcj.a(natClass.o): In function `ZN4java4lang5Class4sizeEv':
>
/usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0
/libjava/java/lang/Class.h(.text$_ZN4java4lang5ClassC1Ev+0x0):
> multiple definition of `java::lang::Class::Class()'

This looks like the case sensivity thing we already squashed. Try looking up
our old patches.

Rob


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling libgjc under cygwin
  2001-07-03 11:34 Compiling libgjc under cygwin Julian Hall
  2001-07-03 15:31 ` Robert Collins
@ 2001-07-04 11:23 ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2001-07-04 11:23 UTC (permalink / raw)
  To: Julian Hall; +Cc: cygwin, java

>>>>> "Julian" == Julian Hall <jules@acris.co.uk> writes:

Julian> Hi; I know that for the moment this is unsupported but I'm
Julian> trying to get libgjc from the gcc-3.0 distribution to compile
Julian> in a cygwin environment.

You'd probably have an easier time starting from the gcc cvs trunk
(aka "3.1").  This way (assuming paperwork is in order and you're
interested in doing this), we could simply check in patches piecemeal
as you write them.

Julian> - I've looked at win32-threads.cc and the threads porting
Julian> documentation, and guess from the looks of it that it should
Julian> work OK as distributed (?)

It is unclear to me.  I believe the Windows thread code is largely
correct, but it doesn't properly implement Thread.interrupt (neither
does the Posix thread code, right now).  However, I'm far from
certain.  (I see now that other people in this thread have responded
about this.  They are probably right.)

Julian> - I modified configure so that it would recognise gcc's win32
Julian> thread model and choose win32-threads.cc

Nice.  Please send a patch for this.  BTW what is your paperwork
status with the FSF?  Can we get you to sign things so that we can
check in your patches?  (We can accept a small number of small patches
without paperwork, but things really are easier once this hurdle is
cleared.)  If you can sign paperwork, contact me off-list and I will
send you the form.

Julian> - The resulting makefile had java.awt packages that failed to
Julian> compile, so I simply removed all of the awt and related
Julian> sources.  I think the compilation errors here were due to the
Julian> case-insensitivity of the file system: they were effectively
Julian> errors about duplicate class definitions in (eg) image.java
Julian> and Image.java.

We've talked about this on the list before.  I believe compiler
modifications will be necessary to make this work correctly.

Tony Kimball (who is on this list) has done some work on the Windows
port.  I forget what patches he has, but he might have this one.  Also
David Billinghurst has done some work here.  Offhand I don't know his
status either :-(

Julian> - java/util/natGregorianCalendar.cc wasn't compiling
Julian> correctly; I had to forcibly undefine HAVE_TIMEZONE to
Julian> persuade it to work, as the definition of 'timezone' it used
Julian> was incompatible with the cygwin definition.

On the cvs trunk, we've removed natGregorianCalendar.cc.

Julian> - Fastjar required patching in order to function correctly;
Julian> the patch I applied is attached, and simply causes files to be
Julian> opened with the O_BINARY flag if it is defined.

Nice, thanks.  In the future please write a ChangeLog entry when you
send a patch.  I'll check this one in sometime.

Julian> multiple definition of `java::lang::Class::Class()'

I just saw a PR about this.  I'm not positive of the cause, as I have
not seen the problem myself.  The PR recommends changing
java/lang/Class.h so that this:

    Class () {};

becomes:

    Class ();

This seems reasonable to me.

Julian> /usr/local/src/gcc-cygwin-w32threads/i686-pc-cygwin/libjava/../../../gcc-3.0/libjava/win32-threads.cc:129:
Julian> undefined reference to `operator new(unsigned)'

Offhand I don't know why you get this.

Julian> undefined reference to `JNI_OnLoad'

This happens because Windows can't handle the weak definition of
JNI_OnLoad.  The very best approach would be to have a
`HAVE_ATTRIBUTE_WEAK' test in configure.in which would fail on
Windows; then we could conditionally use JNI_OnLoad.

That might be hard to actually write.  So the second best would be to
do the same thing but instead of doing a test, just use a setting in
configure.host.

Julian> ./.libs/libgcj.a(SimpleTimeZone.o)(.data+0x0):SimpleTimeZone.java:
Julian> undefined reference to `Jv_byteVTable'

I don't understand this one.  I don't really know much about Windows,
and what I did know I forgot (I last did Windows work in 1997).  I
seem to recall that there was a difference in the linking model that
made some things work strangely (from a Unix linking perspective).
Some of these undefined references (Jv_*VTable at least) are to data
symbols, not functions.  Does that make a difference?

Failing that, I tend to approach these problems by using `nm' to see
if I can understand what is actually being generated versus what I
expect.  The Jv_*VTable symbols are all defined in prims.cc.

Tom

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Compiling libgjc under cygwin
@ 2001-07-03 16:29 Billinghurst, David (CRTS)
  0 siblings, 0 replies; 4+ messages in thread
From: Billinghurst, David (CRTS) @ 2001-07-03 16:29 UTC (permalink / raw)
  To: 'Julian Hall', cygwin, java

Julian,

Have a look at http://gcc.gnu.org/ml/java/2001-04/msg00377.html .  That work
showed it is possible, but needs polishing.  I put it aside while my
copyright assignment got sorted out  (Must follow up with FSF).  


> -----Original Message-----
> From:	Julian Hall [SMTP:jules@acris.co.uk]
> Sent:	Wednesday, 4 July 2001 4:40
> To:	cygwin@cygwin.com; java@gcc.gnu.org
> Subject:	Compiling libgjc under cygwin
> 
> Hi; I know that for the moment this is unsupported but I'm trying to get
> libgjc from the gcc-3.0 distribution to compile in a cygwin environment.
> 
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-07-04 11:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-03 11:34 Compiling libgjc under cygwin Julian Hall
2001-07-03 15:31 ` Robert Collins
2001-07-04 11:23 ` Tom Tromey
2001-07-03 16:29 Billinghurst, David (CRTS)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).