Web lists-archives.com

Re: [Mingw-users] mingw error: redefinition of 'struct timespec'

On 11/10/15 18:58, Keith Marshall wrote:
> On 11/10/15 18:14, Eli Zaretskii wrote:
>>> From: Keith Marshall <keithmarshall@xxxxxxxxxxxxxxxxxxxxx>
>>> Date: Sun, 11 Oct 2015 17:56:36 +0100
>>> On 11/10/15 16:11, Eli Zaretskii wrote:
>>>> My personal solution is (assuming you don't really need pthreads in
>>>> that project) to rename the pthreads headers, so they "don't exist" as
>>>> far as the configuration scripts are concerned.
>>> 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.
> ...

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

Reality, however, is rather more encouraging ... autoconf isn't so lame.
This minimal configure script:

  $ cat configure.ac
  AC_CHECK_MEMBERS([struct timespec.tv_sec])

when run thus:

  $ autoconf
  $ ./configure --build=linux --host=mingw32
  checking for mingw32-gcc... mingw32-gcc
  checking whether the C compiler works... yes
  checking for C compiler default output file name... a.exe
  checking for suffix of executables... .exe
  checking whether we are cross compiling... yes
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether mingw32-gcc accepts -g... yes
  checking for mingw32-gcc option to accept ISO C89... none needed
  checking how to run the C preprocessor... mingw32-gcc -E
  checking for grep that handles long lines and -e... /bin/grep
  checking for egrep... /bin/grep -E
  checking for ANSI C header files... yes
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for memory.h... yes
  checking for strings.h... yes
  checking for inttypes.h... yes
  checking for stdint.h... yes
  checking for unistd.h... yes
  checking for struct timespec.tv_sec... yes

successfully detects that struct timespec is defined, *without* ever
looking for <pthread.h>:

  $ grep pthread config.log

is completely silent, indicating absolutely no reference whatsoever, to
anything even remotely related to pthreads, so if GNU projects *are*
looking to <pthread.h> for the definition of struct timespec, it is
because individual project maintainers have specified it thus ... quite
inappropriately, IMO.


Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

Attachment: signature.asc
Description: OpenPGP digital signature

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:
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe