Thread: pgsql: plperl: windows: Use Perl_setlocale on 5.28+, fixing compile fai

pgsql: plperl: windows: Use Perl_setlocale on 5.28+, fixing compile fai

From
Andres Freund
Date:
plperl: windows: Use Perl_setlocale on 5.28+, fixing compile failure.

For older versions we need our own copy of perl's setlocale(), because it was
not exposed (why we need the setlocale in the first place is explained in
plperl_init_interp) . The copy stopped working in 5.28, as some of the used
macros are not public anymore.  But Perl_setlocale is available in 5.28, so
use that.

Author: Victor Wagner <vitus@wagner.pp.ru>
Reviewed-By: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/20200501134711.08750c5f@antares.wagner.home
Backpatch: all versions

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8484e38126d7522069e44b81cd41ef53f700b2e1

Modified Files
--------------
src/pl/plperl/plperl.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)


Re: pgsql: plperl: windows: Use Perl_setlocale on 5.28+, fixing compile fai

From
Andres Freund
Date:
Hi,

On 2022-01-31 00:44:39 +0000, Andres Freund wrote:
> plperl: windows: Use Perl_setlocale on 5.28+, fixing compile failure.
> 
> For older versions we need our own copy of perl's setlocale(), because it was
> not exposed (why we need the setlocale in the first place is explained in
> plperl_init_interp) . The copy stopped working in 5.28, as some of the used
> macros are not public anymore.  But Perl_setlocale is available in 5.28, so
> use that.
> 
> Author: Victor Wagner <vitus@wagner.pp.ru>
> Reviewed-By: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
> Discussion: https://postgr.es/m/20200501134711.08750c5f@antares.wagner.home
> Backpatch: all versions
> 
> Branch
> ------
> REL_14_STABLE

I see this broke on everywhere but master. Looking.

Greetings,

Andres Freund



Re: pgsql: plperl: windows: Use Perl_setlocale on 5.28+, fixing compile fai

From
Andres Freund
Date:
Hi,

On 2022-01-30 17:35:48 -0800, Andres Freund wrote:
> I see this broke on everywhere but master. Looking.

Ugh. It's that we didn't backport pport.h.

commit 05798c9f7f08908bdd06c82d934da67535b72005
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   2021-10-07 13:59:43 -0400

    plperl: update ppport.h to Perl 5.34.0.

    Also apply the changes suggested by running
        perl ppport.h --compat-version=5.8.0

    And remove some no-longer-required NEED_foo declarations.

    Dagfinn Ilmari Mannsåker

    Discussion: https://postgr.es/m/87y278s6iq.fsf@wibble.ilmari.org


I didn't see that locally (linux) on the backbranches earlier
because I had the
#if defined(WIN32) && PERL_VERSION_LT(5, 28, 0)
split over two ifdefs. And only merged it in a last bit of cleanup :(

Unless somebody comes up with a better idea quickly I'm going use a plain
PERL_VERSION check in the backbranches. Might also be a good idea to backpatch
the above commit, but that requires more discussion than I want to leave the
buildfarm red for.

Greetings,

Andres Freund



Andres Freund <andres@anarazel.de> writes:
> On 2022-01-30 17:35:48 -0800, Andres Freund wrote:
>> I see this broke on everywhere but master. Looking.

> Ugh. It's that we didn't backport pport.h.

Ooops.

> Unless somebody comes up with a better idea quickly I'm going use a plain
> PERL_VERSION check in the backbranches. Might also be a good idea to backpatch
> the above commit, but that requires more discussion than I want to leave the
> buildfarm red for.

I think we oughta backport.  We didn't do so at the time because
we thought it was mostly cosmetic/future-proofing, but evidently
the future is now.

I can look into that tomorrow or so.

            regards, tom lane



Re: pgsql: plperl: windows: Use Perl_setlocale on 5.28+, fixing compile fai

From
Andres Freund
Date:
Hi,

On 2022-01-30 21:01:07 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2022-01-30 17:35:48 -0800, Andres Freund wrote:
> >> I see this broke on everywhere but master. Looking.
> 
> > Ugh. It's that we didn't backport pport.h.
> 
> Ooops.

I've pushed the quick fix of just using PERL_VERSION for now. That's, as
Ilmari noted, not necessarily future safe, but for now it'll work.


> > Unless somebody comes up with a better idea quickly I'm going use a plain
> > PERL_VERSION check in the backbranches. Might also be a good idea to backpatch
> > the above commit, but that requires more discussion than I want to leave the
> > buildfarm red for.
> 
> I think we oughta backport.  We didn't do so at the time because
> we thought it was mostly cosmetic/future-proofing, but evidently
> the future is now.
> 
> I can look into that tomorrow or so.

Cool. I can either do a revert of the set of commits just now afterwards, or
you can fold that into the backpatch...

Greetings,

Andres Freund



Re: pgsql: plperl: windows: Use Perl_setlocale on 5.28+, fixing compile fai

From
Kyotaro Horiguchi
Date:
At Sun, 30 Jan 2022 17:35:48 -0800, Andres Freund <andres@anarazel.de> wrote in
> Hi,
>
> On 2022-01-31 00:44:39 +0000, Andres Freund wrote:
> > plperl: windows: Use Perl_setlocale on 5.28+, fixing compile failure.
> >
> > For older versions we need our own copy of perl's setlocale(), because it was
> > not exposed (why we need the setlocale in the first place is explained in
> > plperl_init_interp) . The copy stopped working in 5.28, as some of the used
> > macros are not public anymore.  But Perl_setlocale is available in 5.28, so
> > use that.
> >
> > Author: Victor Wagner <vitus@wagner.pp.ru>
> > Reviewed-By: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
> > Discussion: https://postgr.es/m/20200501134711.08750c5f@antares.wagner.home
> > Backpatch: all versions
> >
> > Branch
> > ------
> > REL_14_STABLE
>
> I see this broke on everywhere but master. Looking.

Anyways, I can build on windows with this (even only on
master). Thanks for the work!

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center



Andres Freund <andres@anarazel.de> writes:
> On 2022-01-30 21:01:07 -0500, Tom Lane wrote:
>> I think we oughta backport.  We didn't do so at the time because
>> we thought it was mostly cosmetic/future-proofing, but evidently
>> the future is now.
>> I can look into that tomorrow or so.

> Cool. I can either do a revert of the set of commits just now afterwards, or
> you can fold that into the backpatch...

Done now.

            regards, tom lane



Re: pgsql: plperl: windows: Use Perl_setlocale on 5.28+, fixing compile fai

From
Andres Freund
Date:
On 2022-01-31 15:08:30 -0500, Tom Lane wrote:
> Done now.

Thanks!



Re: pgsql: plperl: windows: Use Perl_setlocale on 5.28+, fixing compile fai

From
Tom Lane
Date:
Andres Freund <andres@anarazel.de> writes:
> On 2022-01-31 15:08:30 -0500, Tom Lane wrote:
>> Done now.

> Thanks!

Just for the archives' sake --- seems this broke pademelon [1]:

cc -Ae -g +O0 -Wp,-H16384 +Z -I. -I. -I../../../src/include  -D_XOPEN_SOURCE_EXTENDED
-I/usr/local/libxml2-2.6.23/include/libxml2-I/usr/local/include -DDEBUGGING
-I/opt/perl5.8.9/lib/5.8.9/PA-RISC2.0-multi/CORE -c -o plperl.o plperl.c 
...
cc: "plperl.c", line 669: error 1000: Unexpected symbol: "do".
cc: "plperl.c", line 669: error 1000: Unexpected symbol: "_sv".
cc: error 2017: Cannot recover from earlier errors, terminating.
make[3]: *** [plperl.o] Error 1

I've not tried to trace that in detail, but it seems clear that
something in the newer ppport.h is assuming a C99-compliant
compiler.  I can hardly blame the Perl guys for assuming that
in 2022, so I'm just going to remove --with-perl from that
animal.

(It appears that Python 3 assumes C99-compliance too, in
a different way [2], so I've also had to remove --with-python.
Maybe I could resurrect that if I built Python 2.7 on that
machine, but I don't think I'm going to summon the motivation.
The world has clearly Moved On from pre-C99 compilers.)

            regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=pademelon&dt=2022-02-02%2000%3A47%3A30
[2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=pademelon&dt=2022-02-02%2000%3A21%3A18