[Bug] - pg_config has wrong LDFLAGS set
Describe the bug
Package libpq-devel-15.0-2.amzn2023.0.1.x86_64 has some strange LDFLAGS set, which in consequence leads to
/usr/bin/ld: cannot open linker script file /builddir/build/BUILD/postgresql-15.0/.package_note-libpq-15.0-2.amzn2023.0.1.x86_64.ld: No such file or directory
To Reproduce
❯ docker run public.ecr.aws/amazonlinux/amazonlinux:2023 bash -c 'dnf install postgresql-devel -y -q >/dev/null; pg_config --ldflags; rpm -qf $(command -v pg_config)'
-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,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/postgresql-15.0/.package_note-libpq-15.0-2.amzn2023.0.1.x86_64.ld -Wl,--as-needed
libpq-devel-15.0-2.amzn2023.0.1.x86_64
On AL2 it is
❯ docker run public.ecr.aws/amazonlinux/amazonlinux:2 bash -c 'yum install postgresql-devel -y -q >/dev/null; pg_config --ldflags; rpm -qf $(command -v pg_config)'
-Wl,-z,relro -Wl,--as-needed
postgresql-9.2.24-8.amzn2.0.1.x86_64
And with postgresql15-server-devel on AL2023
❯ docker run public.ecr.aws/amazonlinux/amazonlinux:2023 bash -c 'dnf install postgresql15-server-devel -y -q >/dev/null; pg_config --ldflags; rpm -qf $(command -v pg_config)'
-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,--build-id=sha1 -L/usr/lib64 -Wl,--as-needed
postgresql15-private-devel-15.4-1.amzn2023.0.1.x86_64
Having kind of a deja vu - https://github.com/amazonlinux/amazon-linux-2023/issues/239 ;)
Different package, same problem, same solution(s): Short term patching libpq.spec with %undefine _package_note_flags and rebuild. Mid term - waiting for you to rebuild the package....
Yeah looks like something's fishy here with package notes again. .. ugh :( We'll fix it, thanks
Interesingly we do have %undefine _package_note_file which was set to fix jsut that,... it looks like it might not be sufficient, strange
I have no reason not to trust in "Interesingly we do have %undefine _package_note_file" was once true. Right now it is not (anymore)
❯ docker run public.ecr.aws/amazonlinux/amazonlinux:2023 bash -c '( dnf install dnf-plugins-core rpm-build -y && dnf download libpq-devel --source && rpm -i libpq* ) >/dev/null 2>&1 && grep -i def /root/rpmbuild/SPECS/*.spec && stat -c "%y - %N" /root/rpmbuild/SPECS/*.spec'
/root/rpmbuild/SPECS/libpq.spec:%define _trivial .0
/root/rpmbuild/SPECS/libpq.spec:%define _buildid .1
2023-02-01 05:17:59.000000000 +0000 - '/root/rpmbuild/SPECS/libpq.spec'
Greetings to Australia
Thanks :-) With the latest 15.4 we ship:
-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,--build-id=sha1 -L/usr/lib64 -Wl,--as-needed
Ah ! But we don't in libpq-devel ... ok I see... bloody postgresql fedora packaging hell... so all that devel stuff is duplicated (and conflicting) between postgresql15-server-devel and libpq-devel... the former has the package notes fixed, the latter doesn't (and is out of date).
Any update ?
Not fixed yet on 16.4-1.amzn2023.0.1...
I try to use postgresql16-server-devel for now but it is too large for dokcer image of db-client application.
Sorry, it looks like we dropped the ball on this, I'll make sure this is attended to asap.
The bug is actually in Fedora (our upstream here), I'll try to get a fix downstream and get it fixed there
This should be addressed in release 2023.6.20241111 out today