sys-auth/oath-toolkit ignores -Wl,--as-needed for some libraries it builds and so links in a ton of unnecessary dependent libraries. /var/tmp/portage/sys-auth/oath-toolkit-2.6.2/work/oath-toolkit-2.6.2/libpskc # readelf -a .libs/libpskc.so | grep NEEDE 0x0000000000000001 (NEEDED) Shared library: [libz.so.1] 0x0000000000000001 (NEEDED) Shared library: [liblzma.so.5] 0x0000000000000001 (NEEDED) Shared library: [libicui18n.so.66] 0x0000000000000001 (NEEDED) Shared library: [libicuuc.so.66] 0x0000000000000001 (NEEDED) Shared library: [libicudata.so.66] 0x0000000000000001 (NEEDED) Shared library: [libxmlsec1.so.1] 0x0000000000000001 (NEEDED) Shared library: [libltdl.so.7] 0x0000000000000001 (NEEDED) Shared library: [libdl.so.2] 0x0000000000000001 (NEEDED) Shared library: [libxslt.so.1] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libxml2.so.2] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] The linking command that make / libtool uses is: x86_64-pc-linux-gnu-gcc -shared -fPIC -DPIC .libs/global.o .libs/errors.o .libs/enums.o .libs/container.o .libs/parser.o .libs/validate.o .libs/build.o .libs/sign.o .libs/output.o -Wl,--whole-archive gl/.libs/libgnu.a -Wl,--no-whole-archive -lz -llzma -licui18n -licuuc -licudata -lxmlsec1 /usr/lib64/libltdl.so -ldl -lxslt -lm -lxml2 -Wl,--as-needed -O3 -march=znver1 -Wl,--version-script=./libpskc.map -Wl,-O1 -Wl,-soname -Wl,libpskc.so.0 -o .libs/libpskc.so.0.0.1 If I move the "-Wl,--as-needed" parameter to a position before depended libraries are specified a much cleaner library is built instead: /var/tmp/portage/sys-auth/oath-toolkit-2.6.2/work/oath-toolkit-2.6.2/libpskc # x86_64-pc-linux-gnu-gcc -shared -fPIC -DPIC .libs/global.o .libs/errors.o .libs/enums.o .libs/container.o .libs/parser.o .libs/validate.o .libs/build.o .libs/sign.o .libs/output.o -Wl,--whole-archive gl/.libs/libgnu.a -Wl,--no-whole-archive -Wl,--as-needed -lz -llzma -licui18n -licuuc -licudata -lxmlsec1 /usr/lib64/libltdl.so -ldl -lxslt -lm -lxml2 -O3 -march=znver1 -Wl,--version-script=./libpskc.map -Wl,-O1 -Wl,-soname -Wl,libpskc.so.0 -o .libs/libpskc.so.0.0.1 /var/tmp/portage/sys-auth/oath-toolkit-2.6.2/work/oath-toolkit-2.6.2/libpskc # readelf -a .libs/libpskc.so | grep NEEDE 0x0000000000000001 (NEEDED) Shared library: [libxmlsec1.so.1] 0x0000000000000001 (NEEDED) Shared library: [libxml2.so.2] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] This bug causes the package to require a (unnecessary) rebuild after a dev-libs/icu update: >>> package: dev-libs/icu-66.1 * - /usr/lib64/libicudata.so.65 * - /usr/lib64/libicudata.so.65.1 * used by /usr/lib64/libpskc.so.0.0.1 (sys-auth/oath-toolkit-2.6.2) * - /usr/lib64/libicui18n.so.65 * - /usr/lib64/libicui18n.so.65.1 * used by /usr/lib64/libpskc.so.0.0.1 (sys-auth/oath-toolkit-2.6.2) * - /usr/lib64/libicuuc.so.65 * - /usr/lib64/libicuuc.so.65.1 * used by /usr/lib64/libpskc.so.0.0.1 (sys-auth/oath-toolkit-2.6.2)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=93b66e313c8f85be009ac2c6ee3a70938ee49058 commit 93b66e313c8f85be009ac2c6ee3a70938ee49058 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-03-05 12:35:32 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-03-05 12:37:22 +0000 sys-auth/oath-toolkit: add 2.6.7 Bug: https://bugs.gentoo.org/719314 Closes: https://bugs.gentoo.org/683864 Closes: https://bugs.gentoo.org/719310 Closes: https://bugs.gentoo.org/775278 Closes: https://bugs.gentoo.org/827887 Closes: https://bugs.gentoo.org/837791 Closes: https://bugs.gentoo.org/898740 Signed-off-by: Sam James <sam@gentoo.org> sys-auth/oath-toolkit/Manifest | 1 + .../oath-toolkit-2.6.7-new-xmlsec-tests.patch | 74 ++++++++++++++++++++++ sys-auth/oath-toolkit/oath-toolkit-2.6.7.ebuild | 74 ++++++++++++++++++++++ 3 files changed, 149 insertions(+)