Re: [Mingw-users] mingw error: redefinition of 'struct timespec'
- Date: Sun, 11 Oct 2015 21:39:37 +0300
- From: Eli Zaretskii <eliz@xxxxxxx>
- Subject: Re: [Mingw-users] mingw error: redefinition of 'struct timespec'
> From: Keith Marshall <keithmarshall@xxxxxxxxxxxxxxxxxxxxx>
> Date: Sun, 11 Oct 2015 18:58:40 +0100
> >> A reasonable approach, but kind of begs the question ... if the project
> >> doesn't need pthreads, why would its configuration script(s) check for
> >> <pthread.h>?
> > Because the standard GNU configure tests "know" this is one place
> > where 'struct timespec' is declared.
> Ah. Okay, thanks for that clarification, but (being pedantic) should it
> not rather look to <sched.h>, since that is where POSIX.1 requires
> struct timespec to be defined? (Of course, that definition would then
> propagate through <pthread.h>, which is required to expose all of the
> definitions within <sched.h> anyway, but selecting the outer header is
> nothing short of blatant namespace pollution, especially since the
> preferred origin for struct timespec is <time.h> in the first place).
They do try pthread.h, and pthread.h indeed includes sched.h.
> > No, most such packages don't use pthreads (or any threads), they just
> > need the struct declaration.
> In which case, they should favour <time.h> as its provider ... yes, I do
> know that mingwrt-3.21 was broken in this respect, but that has been
> corrected in mingwrt-3.21.1. Any preference to elect for inclusion of
> <pthread.h>, rather than <time.h>, if that's what it actually does just
> for struct timespec, seems to me like it may be a misfeature of GNU
Autoconf tends to produce very complex scripts, as you well know.
While it's true that time.h (and sys/time.h) are tried before
pthread.h, I'm quite sure I've seen semi-buggy packages that sometimes
have it the other way around, especially in nested configure scripts,
or even just hard-code use of struct timespec by #ifdef HAVE_PTHREAD_H.
It's a mess...
MinGW-users mailing list
This list observes the Etiquette found at
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
You may change your MinGW Account Options or unsubscribe at: