Re: [RFC] building postgres with meson - perl embedding

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: [RFC] building postgres with meson - perl embedding
Date: 2022-02-08 03:19:33
Message-ID: 20220208031933.xa24sjqznmnhrmzx@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-02-07 20:42:09 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > What is the reason behind subtracting ccdlflags?
>
> It looks like the coding actually originated here:
>
> commit f5d0c6cad5bb2706e0e63f3f8f32e431ea428100
> Author: Bruce Momjian <bruce(at)momjian(dot)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.

Yea. And maybe what was broken in 2001 isn't broken anymore either ;)

Looking at a number of OSs:

debian sid:
embed: -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.34/CORE -lperl -ldl -lm -lpthread -lc -lcrypt
ldopts: -Wl,-E

fedora:
embed: -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fstack-protector-strong -L/usr/local/lib -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc
ldopts: -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1

suse tumbleweed:
embed: -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.34.0/x86_64-linux-thread-multi/CORE -L/usr/local/lib64 -fstack-protector-strong -L/usr/lib/perl5/5.34.0/x86_64-linux-thread-multi/CORE -lperl -lm -ldl -lcrypt -lpthread
ldopts: -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.34.0/x86_64-linux-thread-multi/CORE

freebsd:
embed: -Wl,-R/usr/local/lib/perl5/5.30/mach/CORE -pthread -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/local/lib/perl5/5.30/mach/CORE -lperl -lpthread -lm -lcrypt -lutil
ldopts: -Wl,-R/usr/local/lib/perl5/5.30/mach/CORE

netbsd:
embed: -Wl,-E -Wl,-R/usr/pkg/lib/perl5/5.34.0/x86_64-netbsd-thread-multi/CORE -pthread -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -L/usr/pkg/lib/perl5/5.34.0/x86_64-netbsd-thread-multi/CORE -lperl -lm -lcrypt -lpthread
ldopts: -Wl,-E -Wl,-R/usr/pkg/lib/perl5/5.34.0/x86_64-netbsd-thread-multi/CORE

openbsd:
embed: -Wl,-R/usr/libdata/perl5/amd64-openbsd/CORE -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/libdata/perl5/amd64-openbsd/CORE -lperl -lm -lc
ldopts: -Wl,-R/usr/libdata/perl5/amd64-openbsd/CORE

aix:
embed: -bE:/usr/opt/perl5/lib64/5.28.1/aix-thread-multi-64all/CORE/perl.exp -bE:/usr/opt/perl5/lib64/5.28.1/aix-thread-multi-64all/CORE/perl.exp -brtl -bdynamic -b64 -L/usr/opt/perl5/lib64/5.28.1/aix-thread-multi-64all/CORE -lperl -lpthread -lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc
ldopts: -bE:/usr/opt/perl5/lib64/5.28.1/aix-thread-multi-64all/CORE/perl.exp -bE:/usr/opt/perl5/lib64/5.28.1/aix-thread-multi-64all/CORE/perl.exp

mac m1 monterey:
embed: -fstack-protector-strong -L/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE -lperl
ldopts:

windows msys install ucrt perl:
embed: -s -L"C:\dev\msys64\ucrt64\lib\perl5\core_perl\CORE" -L"C:\dev\msys64\ucrt64\lib" "C:\dev\msys64\ucrt64\lib\perl5\core_perl\CORE\libperl532.a"
ldopts:

windows strawberrry perl:
embed: -s -L"C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib" "C:\STRAWB~1\perl\lib\CORE\libperl530.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmoldname.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libkernel32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuser32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomdlg32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libadvapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libshell32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libole32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\liboleaut32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libnetapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuuid.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libws2_32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmpr.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinmm.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libversion.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbc32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbccp32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomctl32.a"
ldopts:

So on windows, macos it makes no difference because ldopts is empty.

On various linuxes, except red-hat and debian ones, as well as on the BSDs, it
removes rpath. Which we then add back in various places (pl and transform
modules). On debian the added rpath never will contain the library.

AIX is the one exception. Specifying -bE... doesn't seem right for building
plperl etc. So possibly the subtraction accidentally does work for us there...

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

Except for the AIX thing I agree :(

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-02-08 03:38:46 shared_preload_libraries = 'pg_stat_statements' failing with installcheck (compute_query_id = auto)
Previous Message Justin Pryzby 2022-02-08 03:07:28 Re: GUC flags