From ligges at statistik.uni-dortmund.de  Fri Oct  3 20:34:39 2003
From: ligges at statistik.uni-dortmund.de (Uwe Ligges)
Date: Fri Oct  3 19:32:49 2003
Subject: [Rd] latest beta + MinGW 3.1.0-1 = minor fix needed
In-Reply-To: <3F7DACFF.9030306@math.uni-augsburg.de>
References: <3F7DACFF.9030306@math.uni-augsburg.de>
Message-ID: <3F7DB32F.4030701@statistik.uni-dortmund.de>

Simon Urbanek wrote:

> MinGW 3.1.0-1 is currently the latest official MinGW release, therefore 
> I tried to compile the latest R beta (rsync today). There is one minor 
> problem when trying that:
> 
> gcc  -O2 -Wall -pedantic -I../../include -I../../gnuwin32 
> -DHAVE_CONFIG_H  -c internet.c -o internet.o
> In file included from internet.c:880:
> sock.h:23: conflicting types for `ssize_t'
> n:/MinGW/include/sys/types.h:119: previous declaration of `ssize_t'
> make[3]: *** [internet.o] Error 1
> 
> (This is in src/modules/internet)
> 
> Obviously ssize_t was added to the system types in MinGW. The 
> corresponding files:
> 
> MinGW: sys/types.h:
> 
> #ifndef _SSIZE_T_
> #define _SSIZE_T_
> typedef long _ssize_t;
> 
> R: src/modules/internet/sock.h
> 
> #ifdef Win32
> typedef int ssize_t;
> #endif
> 
> There are two possible fixes for this:
> 1) make sock.h use long instead of int.
> 2) use something like:
> #if defined Win32 && !defined _SSIZE_T_
> 
> I don't think either fix is "better" in any way, but personally I'd go 
> for the "long" (for Win32 I don't see any difference, but for Win64 fix 
> 2) may be less safe?).
> 
> Configuration:
> MinGW 3.1.0-1
> w32api 2.4
> 
> Simon


Simon,

it does not happen with MinGW's gcc-3.3.1 candidate release we (Duncan 
and myself) use for compiling R base + packages.
The gcc-3.3.1 candidate is older (2003-08-07) than the official release 
(2003-09-14, gcc-3.2.?) you are using, though.

Some thoughts:
The first suggested fix seems to be forbidden during code freeze (might 
break other platforms, doesn't it?), the second one puts one more OS 
dependence into the sources.
Another solution is to hope for an official MinGW release of gcc-3.3.1 
with the change you are reporting reverted before the release of R-1.8.1 
(of course one should document not to use MinGW 3.1.0-1 as is).

Uwe


[Rd] latest beta + MinGW 3.1.0-1 = minor fix needed
Uwe Ligges