1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-27 22:56:53 +03:00

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.
This commit is contained in:
Andrew Dunstan 2024-09-14 08:37:08 -04:00
parent d23109f4bd
commit 0a0db46313
2 changed files with 7 additions and 2 deletions

View File

@ -1060,9 +1060,12 @@ if not perlopt.disabled()
if cc.get_id() == 'msvc' if cc.get_id() == 'msvc'
# prevent binary mismatch between MSVC built plperl and Strawberry or # prevent binary mismatch between MSVC built plperl and Strawberry or
# msys ucrt perl libraries # msys ucrt perl libraries
perl_v = run_command(perl, '-V').stdout()
if not perl_v.contains('USE_THREAD_SAFE_LOCALE')
perl_ccflags += ['-DNO_THREAD_SAFE_LOCALE'] perl_ccflags += ['-DNO_THREAD_SAFE_LOCALE']
endif endif
endif endif
endif
message('CCFLAGS recommended by perl: @0@'.format(perl_ccflags_r)) message('CCFLAGS recommended by perl: @0@'.format(perl_ccflags_r))
message('CCFLAGS for embedding perl: @0@'.format(' '.join(perl_ccflags))) message('CCFLAGS for embedding perl: @0@'.format(' '.join(perl_ccflags)))

View File

@ -595,7 +595,9 @@ sub mkvcbuild
push(@perl_embed_ccflags, 'PLPERL_HAVE_UID_GID'); push(@perl_embed_ccflags, 'PLPERL_HAVE_UID_GID');
# prevent binary mismatch between MSVC built plperl and # prevent binary mismatch between MSVC built plperl and
# Strawberry or msys ucrt perl libraries # 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 # Windows offers several 32-bit ABIs. Perl is sensitive to
# sizeof(time_t), one of the ABI dimensions. To get 32-bit time_t, # sizeof(time_t), one of the ABI dimensions. To get 32-bit time_t,