public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll
@ 2004-07-29  1:45 dannysmith at users dot sourceforge dot net
  2004-07-29  2:04 ` [Bug libgcj/16814] " mckinlay at redhat dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2004-07-29  1:45 UTC (permalink / raw)
  To: java-prs

Currently, the inclusion of windows.h in include/win32.h causes the windows 
socket interface to default to the 2.2 version, since windows.h includes the 
winsock2.h  header.  That's okay.  However, in libgcj.spec the lib order is:

*lib: -lgcj -lm     -lgdi32 -lwsock32 -lws2_32 

ie, the winsock version 1 library is linked in before the winsock 2 libary.  
Linking in both dll's is dangerous, especially if you assume the version 2 api 
but link in the version 1 library first.  See the article:
[257460] INFO: Header and Library Requirement When Set/Get Socket Options at 
the IPPROTO_IP Level

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q257460

-- 
           Summary: [mingw32] libgcj dpends on both winsock32dll and
                    ws2_32.dll
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at users dot sourceforge dot net
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
 GCC build triplet: i386-pc-mingw32
  GCC host triplet: i386-pc-mingw32
GCC target triplet: i386-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
@ 2004-07-29  2:04 ` mckinlay at redhat dot com
  2004-07-29  2:19 ` dannysmith at users dot sourceforge dot net
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-29  2:04 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-07-29 02:04 -------
Can you suggest a patch? Remove -lwsock32, or swap them around?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
  2004-07-29  2:04 ` [Bug libgcj/16814] " mckinlay at redhat dot com
@ 2004-07-29  2:19 ` dannysmith at users dot sourceforge dot net
  2004-07-29  2:33 ` mckinlay at redhat dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2004-07-29  2:19 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From dannysmith at users dot sourceforge dot net  2004-07-29 02:19 -------
The patch is trivial.  Just remove -lwsock32 from SYSTEMSPEC in configure.in.
To be extra safe,  also force the choice of winsock2.h by explicitly including 
it before including windows.h in win32.h (just in case someone is using an old 
or modified  windows.h that has a different default) 

Danny

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
  2004-07-29  2:04 ` [Bug libgcj/16814] " mckinlay at redhat dot com
  2004-07-29  2:19 ` dannysmith at users dot sourceforge dot net
@ 2004-07-29  2:33 ` mckinlay at redhat dot com
  2004-07-29  4:51 ` [Bug libgcj/16814] [win32] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-29  2:33 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-07-29 02:33 -------
Even though its trivial, I can't test mingw builds easily, and without testing
its quite likely I'd break something :)

If you'd like to test and submit a patch, it would be most appreciated. In fact,
you can consider this change pre-approved.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [win32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2004-07-29  2:33 ` mckinlay at redhat dot com
@ 2004-07-29  4:51 ` pinskia at gcc dot gnu dot org
  2004-07-29  6:53 ` rmathew at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-29  4:51 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-29 04:51 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-29 04:51:44
               date|                            |
            Summary|[mingw32] libgcj dpends on  |[win32] libgcj dpends on
                   |both winsock32dll and       |both winsock32dll and
                   |ws2_32.dll                  |ws2_32.dll


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [win32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  2004-07-29  4:51 ` [Bug libgcj/16814] [win32] " pinskia at gcc dot gnu dot org
@ 2004-07-29  6:53 ` rmathew at gcc dot gnu dot org
  2004-07-29 14:46 ` mckinlay at redhat dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2004-07-29  6:53 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From rmathew at gcc dot gnu dot org  2004-07-29 06:53 -------
(In reply to comment #0)
> Currently, the inclusion of windows.h in include/win32.h causes the windows 
> socket interface to default to the 2.2 version, since windows.h includes the 
> winsock2.h  header.  That's okay.  However, in libgcj.spec the lib order is:
> 
> *lib: -lgcj -lm     -lgdi32 -lwsock32 -lws2_32 
> 
> ie, the winsock version 1 library is linked in before the winsock 2 libary.  
> Linking in both dll's is dangerous, especially if you assume the version 2 api 
> but link in the version 1 library first.

See:

  http://gcc.gnu.org/ml/java-patches/2002-q4/msg00101.html
  http://gcc.gnu.org/ml/java/2002-10/threads.html#00238

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [win32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
                   ` (4 preceding siblings ...)
  2004-07-29  6:53 ` rmathew at gcc dot gnu dot org
@ 2004-07-29 14:46 ` mckinlay at redhat dot com
  2004-07-31  2:17 ` dannysmith at users dot sourceforge dot net
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-29 14:46 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-07-29 14:46 -------
Please go ahead and check that patch in if you still think it is relavent. Win95
compatibility is not an important consideration. Sounds like it avoids bugs and
improves performance to use winsock2 exclusively, so lets do it.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [win32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
                   ` (5 preceding siblings ...)
  2004-07-29 14:46 ` mckinlay at redhat dot com
@ 2004-07-31  2:17 ` dannysmith at users dot sourceforge dot net
  2004-07-31 19:27 ` mckinlay at redhat dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2004-07-31  2:17 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From dannysmith at users dot sourceforge dot net  2004-07-31 02:17 -------
Comment 6 appears to be directed to Ranjit, so I haven't done anything yet.

Here is the patch that I have tested on native mingw32 build

2004-07-31  Danny Smith  <dannysmith@users.sourceforge.net>

	PR gcj/16814
	* configure.in [host *mingw*] (SYSTEMSPEC): Remove -lwsock32.
	* configure. Regenerate.
	* include/win32.h: Explicitly include winsock2.h
	* win32.cc (_Jv_platform_initialize): Require version 2.2 of
	Winsock api.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.196
diff -c -3 -p -r1.196 configure.in
*** configure.in	23 Jul 2004 23:34:16 -0000	1.196
--- configure.in	31 Jul 2004 01:08:09 -0000
*************** AC_LINK_FILES(gnu/java/nio/channels/natF
*** 481,487 ****
  
  case "${host}" in
      *mingw*)
!       SYSTEMSPEC="-lgdi32 -lwsock32 -lws2_32"
        if test "${with_win32_nlsapi}" = "unicows"; then
          SYSTEMSPEC="-lunicows $SYSTEMSPEC"
        fi
--- 481,487 ----
  
  case "${host}" in
      *mingw*)
!       SYSTEMSPEC="-lgdi32 -lws2_32"
        if test "${with_win32_nlsapi}" = "unicows"; then
          SYSTEMSPEC="-lunicows $SYSTEMSPEC"
        fi
Index: win32.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/win32.cc,v
retrieving revision 1.21
diff -c -3 -p -r1.21 win32.cc
*** win32.cc	16 Dec 2003 22:54:21 -0000	1.21
--- win32.cc	31 Jul 2004 01:08:11 -0000
*************** _Jv_platform_initialize (void)
*** 256,262 ****
  {
    // Initialise winsock for networking
    WSADATA data;
!   if (WSAStartup (MAKEWORD (1, 1), &data))
      MessageBox (NULL, _T("Error initialising winsock library."), _T("Error"),
      MB_OK | MB_ICONEXCLAMATION);
  
--- 256,262 ----
  {
    // Initialise winsock for networking
    WSADATA data;
!   if (WSAStartup (MAKEWORD (2, 2), &data))
      MessageBox (NULL, _T("Error initialising winsock library."), _T("Error"),
      MB_OK | MB_ICONEXCLAMATION);
  
Index: include/win32.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/win32.h,v
retrieving revision 1.26
diff -c -3 -p -r1.26 win32.h
*** include/win32.h	16 Dec 2003 22:54:22 -0000	1.26
--- include/win32.h	31 Jul 2004 01:09:03 -0000
*************** details.  */
*** 22,27 ****
--- 22,29 ----
  
  // Includes
  #define WIN32_LEAN_AND_MEAN
+ // Force Winsock 2 interface.
+ #include <winsock2.h>
  #include <windows.h>
  #undef WIN32_LEAN_AND_MEAN
  #undef STRICT

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [win32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
                   ` (6 preceding siblings ...)
  2004-07-31  2:17 ` dannysmith at users dot sourceforge dot net
@ 2004-07-31 19:27 ` mckinlay at redhat dot com
  2004-08-01  4:37 ` dannysmith at users dot sourceforge dot net
  2004-08-01  8:43 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-31 19:27 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-07-31 19:27 -------
Danny, this patch looks fine. OK to commit. Please send a note with the patch to
java-patches@gcc.gnu.org as well. Thanks.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [win32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
                   ` (7 preceding siblings ...)
  2004-07-31 19:27 ` mckinlay at redhat dot com
@ 2004-08-01  4:37 ` dannysmith at users dot sourceforge dot net
  2004-08-01  8:43 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2004-08-01  4:37 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From dannysmith at users dot sourceforge dot net  2004-08-01 04:37 -------
Fixed on trunk
Danny

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

* [Bug libgcj/16814] [win32] libgcj dpends on both winsock32dll and ws2_32.dll
  2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
                   ` (8 preceding siblings ...)
  2004-08-01  4:37 ` dannysmith at users dot sourceforge dot net
@ 2004-08-01  8:43 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-01  8:43 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16814


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

end of thread, other threads:[~2004-08-01  8:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-29  1:45 [Bug libgcj/16814] New: [mingw32] libgcj dpends on both winsock32dll and ws2_32.dll dannysmith at users dot sourceforge dot net
2004-07-29  2:04 ` [Bug libgcj/16814] " mckinlay at redhat dot com
2004-07-29  2:19 ` dannysmith at users dot sourceforge dot net
2004-07-29  2:33 ` mckinlay at redhat dot com
2004-07-29  4:51 ` [Bug libgcj/16814] [win32] " pinskia at gcc dot gnu dot org
2004-07-29  6:53 ` rmathew at gcc dot gnu dot org
2004-07-29 14:46 ` mckinlay at redhat dot com
2004-07-31  2:17 ` dannysmith at users dot sourceforge dot net
2004-07-31 19:27 ` mckinlay at redhat dot com
2004-08-01  4:37 ` dannysmith at users dot sourceforge dot net
2004-08-01  8:43 ` pinskia at gcc dot gnu dot org

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).