Skip to content

latest beta + MinGW 3.1.0-1 = minor fix needed

6 messages · Uwe Ligges, Peter Dalgaard, Duncan Murdoch +1 more

#
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 Urbanek wrote:

            
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
#
On Friday, October 3, 2003, at 07:34 PM, Uwe Ligges wrote:

            
The neither fix affects any platform except for Win32 - and that's the 
one we're fixing ;) - it's inside #ifdef Win32 - so I hope no other 
platform sets that define ;). On Win32 gcc int = long so in fact 
nothing should change - except for the error that would go away.

Simon
#
Uwe Ligges <ligges@statistik.uni-dortmund.de> writes:
Fixes that are NOPs on non-broken setups should be allowable...
Version 2) looks most correct to me: We want to use the system
definition wherever it is available, and it would obviously only
change anything on Win32.
#
On 04 Oct 2003 14:15:59 +0200, you wrote:

            
It compiles fine in 3.3.1 with change 2).  I'll commit the change.  I
don't have 3.2.3 installed to test there, so could you try a build
soon Simon?

Duncan
#
On Saturday, October 4, 2003, at 04:05 PM, Duncan Murdoch wrote:

            
Thank you, Duncan, it compiles fine with MinGW 3.1.0-1 (@Peter: it uses 
[modified] gcc-3.2.3)

BTW: The "improved" sys/types.h is also contained in the 
mingw-runtime-3.1.tar.gz, so presumably you can use it with the gcc 
3.3.1 candidate as well.

Cheers,
Simon