https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: dev-libs/elfutils-0.187 fails tests (MUSL). Discovered on: amd64 (internal ref: tinderbox_musl) NOTE: This machine uses MUSL libc
Created attachment 799123 [details] build.log.xz build log and emerge --info (compressed because it exceeds attachment limit, use 'xzless' to read it)
Error(s) that match a know pattern in addition to what has been reported in the summary: /var/tmp/portage/dev-libs/elfutils-0.187/work/elfutils-0.187/tests/saridx.c:106: undefined reference to `error' collect2: error: ld returned 1 exit status
Created attachment 917580 [details] build.log w/o USE="test" and FEATURE="test"
> Created attachment 917580 [details] > build.log w/o USE="test" and FEATURE="test" it fails to build if using profile: default/linux/amd64/23.0/musl/llvm following is the summary of what I've found: 1. libc: glibc & musl are available. glibc has built-in implementation of error() in /usr/include/error.h; musl don't have built-in one but can be provided by sys-libs/error-standalone 2. lib/error.c of dev-libs/elfutils have a bultin-in implementation of error() if "#if !defined(HAVE_ERROR_H) && defined(HAVE_ERR_H)" 3. configure.ac of dev-libs/elfutils have "AC_CHECK_HEADERS([error.h])", it check header file only, but for musl, "-lerror" is required otherwise link will fail. for "AC_CHECK_HEADERS([err.h])", "err.h" is available for both glibc & musl, so HAVE_ERR_H is always 1. 4. for glibc, current ebuild is ok. 5. for musl, current ebuild is ok if no sys-libs/error-standlone installed (because no HAVE_ERROR_H, built-in error() in lib/error.c will be used); fails to build if sys-libs/error-standlone is installed (may be pulled in by other ebuild, such as debugedit) because "-lerror" is not provided when link. So here comes the solution: 1. for musl, add depend to "sys-libs/error-standalone" and passed "-lerror" always. This is the PR. 2. modify configure.ac by upstream, check link of error() to find whether "-lerror" is required.
In future do not repurpose bug. This was fixed upstream in https://sourceware.org/git/?p=elfutils.git;a=commit;h=6284f4d12ccbc6405e986fd84ac6d4d72dc9c2a7