amazon-linux-2023 icon indicating copy to clipboard operation
amazon-linux-2023 copied to clipboard

[Bug] - pg_config has wrong LDFLAGS set

Open pluralistix opened this issue 2 years ago • 5 comments

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....

pluralistix avatar Oct 25 '23 06:10 pluralistix

Yeah looks like something's fishy here with package notes again. .. ugh :( We'll fix it, thanks

ozbenh avatar Oct 27 '23 01:10 ozbenh

Interesingly we do have %undefine _package_note_file which was set to fix jsut that,... it looks like it might not be sufficient, strange

ozbenh avatar Oct 27 '23 01:10 ozbenh

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

pluralistix avatar Oct 27 '23 14:10 pluralistix

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).

ozbenh avatar Oct 27 '23 22:10 ozbenh

Any update ?

rabin999 avatar May 14 '24 09:05 rabin999

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.

nabe1653 avatar Oct 21 '24 02:10 nabe1653

Sorry, it looks like we dropped the ball on this, I'll make sure this is attended to asap.

ozbenh avatar Oct 22 '24 02:10 ozbenh

The bug is actually in Fedora (our upstream here), I'll try to get a fix downstream and get it fixed there

ozbenh avatar Oct 26 '24 01:10 ozbenh

This should be addressed in release 2023.6.20241111 out today

ozbenh avatar Nov 14 '24 23:11 ozbenh