Re: [RFC] building postgres with meson - perl embedding - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [RFC] building postgres with meson - perl embedding
Date
Msg-id 1120094.1644284529@sss.pgh.pa.us
Whole thread Raw
In response to Re: [RFC] building postgres with meson - perl embedding  (Andres Freund <andres@anarazel.de>)
Responses Re: [RFC] building postgres with meson - perl embedding  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [RFC] building postgres with meson - perl embedding  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> What is the reason behind subtracting ccdlflags?

It looks like the coding actually originated here:

commit f5d0c6cad5bb2706e0e63f3f8f32e431ea428100
Author: Bruce Momjian <bruce@momjian.us>
Date:   Wed Jun 20 00:26:06 2001 +0000

    Apparently, on some systems, ExtUtils::Embed and MakeMaker are slightly
    broken, and its impossible to make a shared library when compiling with
    both CCDLFLAGS and LDDLFAGS, you have to pick one or the other.

    Alex Pilosov

and Peter just copied the logic in 7662419f1.  Considering that
the point of 7662419f1 was to get rid of MakeMaker, maybe we no
longer needed that at that point.

On my RHEL box, the output of ldopts is sufficiently redundant
that the subtraction doesn't actually accomplish much:

$ perl -MExtUtils::Embed -e ldopts
-Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld-fstack-protector-strong -L/usr/local/lib  -L/usr/lib64/perl5/CORE -lperl
-lpthread-lresolv -ldl -lm -lcrypt -lutil -lc 

$ perl -MConfig -e 'print $Config{ccdlflags}'
-Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld

which leads to

$ grep perl_embed_ldflags src/Makefile.global
perl_embed_ldflags      =  -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
-fstack-protector-strong-L/usr/local/lib  -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc 

so the only thing we actually got rid of was -Wl,--enable-new-dtags,
which I think we'll put back anyway.

Things might be different elsewhere of course, but I'm tempted
to take out the ccdlflags subtraction and see what the buildfarm
says.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [RFC] building postgres with meson - autogenerated headers
Next
From: "Jonathan S. Katz"
Date:
Subject: Re: 2022-02-10 release announcement draft