Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 864787 - dev-libs/elfutils-0.187 fails tests (MUSL): saridx.c:106: undefined reference to error
Summary: dev-libs/elfutils-0.187 fails tests (MUSL): saridx.c:106: undefined reference...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-08-10 12:12 UTC by Agostino Sarubbo
Modified: 2025-01-27 03:25 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.xz (build.log.xz,27.98 KB, application/x-xz)
2022-08-10 12:12 UTC, Agostino Sarubbo
Details
build.log w/o USE="test" and FEATURE="test" (build.log,684.18 KB, application/octet-stream)
2025-01-27 00:51 UTC, Zhixu Liu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-08-10 12:12:19 UTC
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
Comment 1 Agostino Sarubbo gentoo-dev 2022-08-10 12:12:21 UTC
Created attachment 799123 [details]
build.log.xz

build log and emerge --info (compressed because it exceeds attachment limit, use 'xzless' to read it)
Comment 2 Agostino Sarubbo gentoo-dev 2022-08-10 12:12:22 UTC
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
Comment 3 Zhixu Liu 2025-01-27 00:51:14 UTC
Created attachment 917580 [details]
build.log w/o USE="test" and FEATURE="test"
Comment 4 Zhixu Liu 2025-01-27 01:40:49 UTC
> 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.
Comment 5 Alfred Wingate 2025-01-27 03:25:29 UTC
In future do not repurpose bug.

This was fixed upstream in
https://sourceware.org/git/?p=elfutils.git;a=commit;h=6284f4d12ccbc6405e986fd84ac6d4d72dc9c2a7