Summary: | dev-libs/elfutils-0.187 fails tests (MUSL): saridx.c:106: undefined reference to error | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Agostino Sarubbo <ago> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED UPSTREAM | ||
Severity: | normal | CC: | parona, zhixu.liu |
Priority: | Normal | Keywords: | PullRequest |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://github.com/gentoo/gentoo/pull/40322 https://bugs.gentoo.org/show_bug.cgi?id=948878 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
build.log.xz
build.log w/o USE="test" and FEATURE="test" |
Description
Agostino Sarubbo
![]() 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 |