sys-auth/nss_ldap-265's toplevel Makefile.am contains: LIBC_VERS = $(shell ls /lib/$(MULTI_OS_DIRECTORY)/libc-*.so | tail -n 1 | sed -e 's|.*libc-\(.*\)\.so|\1|') NSS_LDAP_LIBC_VERSIONED = libnss_ldap-$(LIBC_VERS).so This will get the wrong LIBC_VERS if the libc in $ROOT and / have a different version. Since it is $ROOT related, which is Gentoo specific, I did not file a complaint upstream. However, maybe this can be fixed by adding a $(PREFIX) at the appropriate position in the Makefile.am, which would be a fix that is upstreamable. Reproducible: Always