bug-gnulib
[Top][All Lists]
Advanced

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

Re: setlocale with NULL locale (to read current locale) segfaults on MSY


From: Reuben Thomas
Subject: Re: setlocale with NULL locale (to read current locale) segfaults on MSYS
Date: Sun, 1 May 2022 22:13:34 +0100

On Sat, 30 Apr 2022 at 12:44, Bruno Haible <bruno@clisp.org> wrote:
Reuben Thomas wrote:
> on MSYS it goes wrong
> ...
> setlocale_null_with_lock (category=category@entry=0, buf=buf@entry=0xffffbd80
> "", bufsize=bufsize@entry=3221) at setlocale_null.c:228
> 228       if (pthread_in_use())
> (gdb)
> 230           pthread_mutex_t *lock = gl_get_setlocale_null_lock ();

It looks like you are building the code meant for POSIX platforms on a
native Windows system, and that system's POSIX threads emulation is deficient.

It's not really that I'm doing anything: gnulib seems to detect MSYS as being a POSIX platform.
 
Try configuring with --enable-threads=windows, as documented in
https://www.gnu.org/software/gnulib/manual/html_node/Gnulib-multithreading.html

If that works fine and you want to make it the default, add an invocation of
gl_AVOID_WINPTHREAD to your configure.ac file.

Thanks very much for the hints.

In the end I tried something a bit different, which was to reduce the number of gnulib modules I was using, as for the code I'm writing it seemed reasonable to assume C99 and POSIX.1-2008.

I ran into another minor problem while doing this. My module list was:

bootstrap
filenamecat-lgpl
getline
getopt-gnu
manywarnings
pathmax
relocatable-lib-lgpl
relocatable-script
strcase

On Windows, I got a link error when linking against libgnu, as the dependencies of the modules above cause gnulib's stdlib.h to be installed, and on Windows, rpl_free is defined, but free.c was not compiled into libgnu.

Adding the free-posix module fixed my problem, which looks therefore like a missing dependency.

--
https://rrt.sc3d.org

reply via email to

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