Subject: Re: Failure in building GFortran on Cygwin
From: Corinna Vinschen <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Fri, 30 Nov 2007 15:20:08 +0100
List-Id: <cygwin.cygwin.com>

[Forgot to CC the fortran list.  Re-sending...]

On Nov 29 17:05, Jerry DeLisle wrote:
> Angelo Graziosi wrote:
>> /tmp/gcc/libgfortran/intrinsics/system_clock.c: In function
>> 'system_clock_4':
>> /tmp/gcc/libgfortran/intrinsics/system_clock.c:67: error: storage size of
>> 'tzp' isn't known
>> /tmp/gcc/libgfortran/intrinsics/system_clock.c:67: warning: unused
>> variable 'tzp'
>> /tmp/gcc/libgfortran/intrinsics/system_clock.c: In function
>> 'system_clock_8':
>> /tmp/gcc/libgfortran/intrinsics/system_clock.c:130: error: storage size of
>> 'tzp' isn't known
>> /tmp/gcc/libgfortran/intrinsics/system_clock.c:130: warning: unused
>> variable 'tzp'
>> [...]
>> The Cygwin version is 1.5.25-2 (exp.).
> I can confirm this.  I saw it last wekend trying to do my regular cygwin 
> build of gfortran for the wiki.  The build died and I assumed I did 
> something wrong and was going to try back later.
>
> Well this is definitely a regression somewhere.  Its not on the gfortran 
> side which has not touched that file for several months.  It could be 
> something broke in the configure for cygwin.  The error occurs in a 
> conditional comapile:
>
> #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
>
> I will open a PR to track this.

A simple testcase would have been much more helpful.

>From the name of the variable I assume that tzp is a `struct timezone'
variable.  Given that it's unused, and given that struct timezone is a
BSDism which isn't present in the POSIX standard(*), it might be a good
idea to just remove it entirely from the source or to keep it only when
the build target is a BSD system.

However, this *is* a problem in the newlib/cygwin headers.  Cygwin
exports a timezone function and a _timezone variable.  The timezone
function was an ill-advised invention in Cygwin way back in the last
century.  Unfortunately it has to be kept for backward compatibility.
Alas, we're stuck with the _timezone variable and we have to

  #define timezone _timezone

at one point in the headers.  The problem is that the above define
happens in a Cygwin specific header after the definition of `struct
timezone'.  So the usage of `struct timezone' in application code
results in a `struct _timezone', which is not defined and the above
error occurs.

AFAICS there are at least two ways to solve this problem, but I'm a bit
unsure right now, which is the better one.  Saty tuned.

Corinna

(*) gettimeofday's second parameter is void* in POSIX, see
    http://www.opengroup.org/onlinepubs/009695399/functions/gettimeofday.html

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/