* Re: Can't compile on Windows
[not found] ` <CAGen01h-=t3k0=yacbtZFs=3i5PtqfX--vnKU-vRdDUA3pS-Cg@mail.gmail.com>
@ 2019-05-06 8:18 ` Bruno Haible
2019-05-18 12:44 ` Bruno Haible
0 siblings, 1 reply; 2+ messages in thread
From: Bruno Haible @ 2019-05-06 8:18 UTC (permalink / raw)
To: Michele Locati; +Cc: bug-gnulib
Redirecting to bug-gnulib.
Michele Locati wrote in
<https://lists.gnu.org/archive/html/bug-gettext/2019-04/msg00061.html>:
> > > i686-w64-mingw32.shared-gcc -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -I.
> > > -I/home/m/build-gettext-windows/shared-32/source/gettext-0.20-rc1/gettext-tools/gnulib-tests
> > > -I.. -DIN_GETTEXT_TOOLS_GNULIB_TESTS=1 -I.
> > > -I/home/m/build-gettext-windows/shared-32/source/gettext-0.20-rc1/gettext-tools/gnulib-tests
> > > -I.. -I/home/m/build-gettext-windows/shared-32/source/gettext-0.20-rc1/gettext-tools/gnulib-tests/..
> > > -I../gnulib-lib
> > > -I/home/m/build-gettext-windows/shared-32/source/gettext-0.20-rc1/gettext-tools/gnulib-tests/../gnulib-lib
> > > -I../intl -I/home/m/build-gettext-windows/shared-32/compiled/gettext/include
> > > -g -O2 -c -o pthread_sigmask.o
> > > /home/m/build-gettext-windows/shared-32/source/gettext-0.20-rc1/gettext-tools/gnulib-tests/pthread_sigmask.c
> > > In file included from
> > > /home/m/mxe/usr/i686-w64-mingw32.shared/include/signal.h:10:0,
> > > from ../gnulib-lib/signal.h:52,
> > > from
> > > /home/m/build-gettext-windows/shared-32/source/gettext-0.20-rc1/gettext-tools/gnulib-tests/pthread_sigmask.c:20:
> > > /home/m/build-gettext-windows/shared-32/source/gettext-0.20-rc1/gettext-tools/gnulib-tests/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)
> > > ^
> > > Makefile:5287: recipe for target 'pthread_sigmask.o' failed
> >
> > This has recently been discussed on the gnulib list:
> >
> > https://lists.gnu.org/archive/html/bug-gnulib/2019-04/msg00028.html
> > https://lists.gnu.org/archive/html/bug-gnulib/2019-04/msg00029.html
> > https://lists.gnu.org/archive/html/bug-gnulib/2019-04/msg00035.html
> >
> > But no fix was provided. If you are in a position to provide a solid fix,
> > it will be welcome.
>
> I'm absolutely ignorant about this subject.
> BTW I managed to get past that error with this patch:
>
> --- a/gettext-tools/gnulib-tests/pthread_sigmask.c
> +++ b/gettext-tools/gnulib-tests/pthread_sigmask.c
> @@ -30,9 +30,9 @@
> # include <unistd.h>
> #endif
>
> +#undef pthread_sigmask
> int
> pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
> -#undef pthread_sigmask
> {
> #if HAVE_PTHREAD_SIGMASK
> int ret;
Thanks. This is probably going in the right direction. But this fix is too
"strong": It's a common technique (used in libunistring, libtextstyle, and others)
to "hide" gnulib symbols through preprocessor definitions like this in config.h:
#define pthread_sigmask libfoo_pthread_sigmask
What we would need is a #undef that only undefines the definition from mingw's
header file, but not the one from config.h.
Bruno
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Can't compile on Windows
2019-05-06 8:18 ` Can't compile on Windows Bruno Haible
@ 2019-05-18 12:44 ` Bruno Haible
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2019-05-18 12:44 UTC (permalink / raw)
To: Michele Locati; +Cc: bug-gnulib
> > > > error: expected identifier or '(' before numeric constant
> > > > pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
> > > > ^
I'm reproducing this error now, by compiling gettext-0.20.1 with
--enable-threads=windows.
Or, more simply, with a testdir:
./gnulib-tool --create-testdir --dir=/tmp/testdir --single-configure \
pthread_sigmask lock
configured with --enable-threads=windows.
On 2015-06-01 a patch was added that was meant to fix it, but it has an effect
only in some, not in all cases. This patch should fix it for real.
2019-05-18 Bruno Haible <bruno@clisp.org>
pthread_sigmask: Fix compilation error with --enable-threads=windows.
Reported by Tim Rühsen in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-01/msg00018.html>
and Michele Locati in
<https://lists.gnu.org/archive/html/bug-gettext/2019-04/msg00057.html>.
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Revert change from
2015-06-01. Test whether pthread_sigmask is a macro, regardless of
$LIBMULTITHREAD. Consider it regardless whether module 'threadlib' is
in use and regardless which threads API is chosen.
diff -w --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index cadc239..648edf9 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -1,4 +1,4 @@
-# pthread_sigmask.m4 serial 16
+# pthread_sigmask.m4 serial 17
dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,29 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([pthread_sigmask])
+
+ dnl On MinGW pthread_sigmask is just a macro which always returns 0.
+ dnl It does not exist as a real function, which is required by POSIX.
+ AC_CACHE_CHECK([whether pthread_sigmask is a macro],
+ [gl_cv_func_pthread_sigmask_macro],
+ [AC_EGREP_CPP([headers_define_pthread_sigmask], [
+#include <pthread.h>
+#include <signal.h>
+#ifdef pthread_sigmask
+ headers_define_pthread_sigmask
+#endif],
+ [gl_cv_func_pthread_sigmask_macro=yes],
+ [gl_cv_func_pthread_sigmask_macro=no])
+ ])
+
LIB_PTHREAD_SIGMASK=
+ if test $gl_cv_func_pthread_sigmask_macro = yes; then
+ dnl pthread_sigmask is a dummy macro.
+ HAVE_PTHREAD_SIGMASK=0
+ dnl Make sure to '#undef pthread_sigmask' before defining it.
+ REPLACE_PTHREAD_SIGMASK=1
+ else
dnl Test whether the gnulib module 'threadlib' is in use.
dnl Some packages like Emacs use --avoid=threadlib.
dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
@@ -40,30 +61,6 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
LIBS="$gl_save_LIBS"
])
if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
- AC_CACHE_CHECK([whether pthread_sigmask is only a macro],
- [gl_cv_func_pthread_sigmask_is_macro],
- [gl_save_LIBS="$LIBS"
- LIBS="$LIBS $LIBMULTITHREAD"
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <pthread.h>
- #include <signal.h>
- #undef pthread_sigmask
- ]],
- [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]])
- ],
- [gl_cv_func_pthread_sigmask_is_macro=no],
- [gl_cv_func_pthread_sigmask_is_macro=yes])
- LIBS="$gl_save_LIBS"
- ])
- if test $gl_cv_func_pthread_sigmask_is_macro = yes; then
- dnl On MinGW pthread_sigmask is just a macro which always returns 0.
- dnl It does not exist as a real function, which is required by POSIX.
- REPLACE_PTHREAD_SIGMASK=1
- gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
- fi
- fi
- if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
dnl pthread_sigmask is available with -pthread or -lpthread.
LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
else
@@ -80,8 +77,8 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
dnl multithreading facility.
dnl If "$gl_threads_api" = pth, we could use the function pth_sigmask,
dnl but it is equivalent to sigprocmask, so we choose to emulate
- dnl pthread_sigmask with sigprocmask also in this case. This yields fewer
- dnl link dependencies.
+ dnl pthread_sigmask with sigprocmask also in this case. This yields
+ dnl fewer link dependencies.
if test $ac_cv_func_pthread_sigmask = yes; then
REPLACE_PTHREAD_SIGMASK=1
else
@@ -91,8 +88,8 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
], [
dnl The module 'threadlib' is not in use, due to --avoid=threadlib being
dnl specified.
- dnl The package either has prepared CPPFLAGS and LIBS for use of POSIX:2008
- dnl threads, or wants to build single-threaded programs.
+ dnl The package either has prepared CPPFLAGS and LIBS for use of
+ dnl POSIX:2008 threads, or wants to build single-threaded programs.
if test $ac_cv_func_pthread_sigmask = yes; then
dnl pthread_sigmask exists and does not require extra libraries.
dnl Assume that it is declared.
@@ -106,6 +103,7 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
REPLACE_PTHREAD_SIGMASK=1
fi
])
+ fi
AC_SUBST([LIB_PTHREAD_SIGMASK])
dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-18 12:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CAGen01jBuACDjrAw7Esw+_LUP7LjZP8SkhTe+8rBDVzTaXBLOw@mail.gmail.com>
[not found] ` <7620286.vHYqdNWhsJ@omega>
[not found] ` <CAGen01h-=t3k0=yacbtZFs=3i5PtqfX--vnKU-vRdDUA3pS-Cg@mail.gmail.com>
2019-05-06 8:18 ` Can't compile on Windows Bruno Haible
2019-05-18 12:44 ` Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).