From d94e3b33eaf6c57109a21115572ac78124da5939 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Sat, 14 Sep 2024 08:37:08 -0400 Subject: [PATCH] Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required Latest versions of Strawberry Perl define USE_THREAD_SAFE_LOCALE, and we therefore get a handshake error when building against such instances. The solution is to perform a test to see if USE_THREAD_SAFE_LOCALE is defined and only define NO_THREAD_SAFE_LOCALE if it isn't. Backpatch the meson.build fix back to release 16 and apply the same logic to Mkvcbuild.pm in releases 12 through 16. Original report of the issue from Muralikrishna Bandaru. --- src/tools/msvc/Mkvcbuild.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 1bdc33d7168..1fec887daf1 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -575,7 +575,9 @@ sub mkvcbuild push(@perl_embed_ccflags, 'PLPERL_HAVE_UID_GID'); # prevent binary mismatch between MSVC built plperl and # Strawberry or msys ucrt perl libraries - push(@perl_embed_ccflags, 'NO_THREAD_SAFE_LOCALE'); + my $perl_v = `$^X -V 2>&1`; + push(@perl_embed_ccflags, 'NO_THREAD_SAFE_LOCALE') + unless $perl_v =~ /USE_THREAD_SAFE_LOCALE/; # Windows offers several 32-bit ABIs. Perl is sensitive to # sizeof(time_t), one of the ABI dimensions. To get 32-bit time_t, -- 2.39.5