[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tests on MinGW: undef ref pthread_mutex_lock/unlock

From: Bruno Haible
Subject: Re: Tests on MinGW: undef ref pthread_mutex_lock/unlock
Date: Sat, 13 Apr 2019 17:07:15 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; )

Hi Tim,

Thanks for the more verbose configure output.

I misinterpreted the config.log output; I now see how it was produced even
without --disable-threads.

The logic in threadlib.m4 is as follows:
  - If no preference is given (no --enable-threads={posix|solaris|pth|windows}
    options), the macro attempts to use POSIX threads if possible. This makes
    sense in general, when you think of systems like Haiku or such.
  - Since you have mingw's pthread.h installed, the logic goes this route.

The two errors that you encounter:

  * The error

> >> In file included from /usr/share/mingw-w64/include/signal.h:10,
> >>                  from ./signal.h:52,
> >>                  from pthread_sigmask.c:20:
> >> pthread_sigmask.c:34:1: error: expected identifier or ‘(’ before numeric
> >> constant
> >>  pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
> >>  ^~~~~~~~~~~~~~~

    is caused by
      #define pthread_sigmask(H, S1, S2) 0
    in pthread_signal.h. You could probably easily avoid the error by
    inserting a '#undef pthread_sigmask' at the appropriate place.

  * The error

    libtests.a(localename.o):localename.c:(.text+0x10): undefined reference to 

    is apparently because -lpthread or -lpthread are not occurring on the
    link command line. These link options should be transmitted through
    LIBTHREAD, LTLIBTHREAD in config.status. But I don't see these variables
    in the config.status that you sent me.

    config.status contains a setting of LTLIBPTHREAD, which comes from this
    line in gnutls-3.6.7/configure:

    AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock 

    So this is just a different autoconf test. But it doesn't explain why

Btw, there are two(!) pthreads implementations for mingw.
  - The one that ships with mingw in Debian is initially '(C) 2010 Lockless 
    and is under a BSD license.
  - The one at https://sourceware.org/pthreads-win32/ is by Ross Johnson and
    is under LGPL.
Another difference between the two is explained in

I'm not going to work on this. But if you have time, these would be some
  - Test a gnulib testdir in an environment where you have the mingw-pthreads
    installed. Probably you'll hit the pthread_sigmask problem when you do this.
    Possibly also some test failures.
  - Build your preferred packages
      once with --enable-threads=windows,
      once with --enable-threads=posix and the mingw pthreads,
      once with --enable-threads=posix and the pthreads-win32 package,
    and compare/analyze/report the results.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]