amazonlinux / amazon-linux-2023

Amazon Linux 2023
https://aws.amazon.com/linux/amazon-linux-2023/
Other
523 stars 39 forks source link

[Bug] - pg_config has wrong LDFLAGS set #529

Open pluralistix opened 11 months ago

pluralistix commented 11 months ago

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

ozbenh commented 11 months ago

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

ozbenh commented 11 months ago

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

pluralistix commented 11 months ago

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

ozbenh commented 11 months ago

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

rabin999 commented 4 months ago

Any update ?