Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 701478 - =dev-libs/elfutils-0.177: fails to build on musl: fatal error: error.h: No such file or directory
Summary: =dev-libs/elfutils-0.177: fails to build on musl: fatal error: error.h: No su...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-29 12:37 UTC by Lloyd
Modified: 2021-11-07 06:44 UTC (History)
1 user (show)

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


Attachments
emerge --info etc. all in one file (Gentoo-elfutils-0.177.txt,34.88 KB, text/plain)
2019-11-29 12:38 UTC, Lloyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lloyd 2019-11-29 12:37:09 UTC
I get the error when compiling. With the previous version of elfutils (0.176-r1 I believe) it had worked without errors, on the same system. I have 2 computer arm64 (raspberry pi 3b+) and amd64, the same error on both systems. Both systems with musl as glibc replacement. Both systems are as identical as possible.
I've chosen all the architectures (Switch: Hardware), but it only affects arm64 and amd64, otherwise I would have had to write 2 reports.

Reproducible: Always

Steps to Reproduce:
1. Compile dev-libs/elfutils-0.177

Actual Results:  
make: *** [Makefile:402: all] Error 2
 * ERROR: dev-libs/elfutils-0.177::gentoo failed (compile phase):
 *   emake failed
Comment 1 Lloyd 2019-11-29 12:38:49 UTC
Created attachment 597840 [details]
emerge --info etc. all in one file
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2019-11-29 23:49:53 UTC
Let's post an actual build error so others could relate to this bug report:

"""
aarch64-gentoo-linux-musl-gcc -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"/usr/share/locale"' -I. -I/var/tmp/portage/dev-libs/elfutils-0.178/work/elfutils-0.178/lib -I..  -I. -I/var/tmp/portage/dev-libs/elfutils-0.178/work/elfutils-0.178/lib -I/var/tmp/portage/dev-libs/elfutils-0.178/work/elfutils-0.178/lib -I.. -I/var/tmp/portage/dev-libs/elfutils-0.178/work/elfutils-0.178/lib/../libelf  -std=gnu99 -Wall -Wshadow -Wformat=2 -Wold-style-definition -Wstrict-prototypes -Wtrampolines -Wlogical-op -Wduplicated-cond -Wnull-dereference -Wimplicit-fallthrough=5  -Wunused -Wextra -Wstack-usage=262144   -fPIC -D_FORTIFY_SOURCE=2 -march=native -mtune=native -O2 -pipe -c -o xstrndup.o /var/tmp/portage/dev-libs/elfutils-0.178/work/elfutils-0.178/lib/xstrndup.c
In file included from /var/tmp/portage/dev-libs/elfutils-0.178/work/elfutils-0.178/lib/xstrndup.c:36:
/var/tmp/portage/dev-libs/elfutils-0.178/work/elfutils-0.178/lib/system.h:33:10: fatal error: error.h: No such file or directory
   33 | #include <error.h>
      |          ^~~~~~~~~
"""

elfutils is known not to work on musl upstream: bug #602126.

elfutils-0.178 builds fine here on amd64/glibc. Please post emerge --info and build.log from that system. It's unexpected to have build failures there.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-11-29 23:50:56 UTC
(In reply to Sergei Trofimovich from comment #2)

> elfutils-0.178 builds fine here on amd64/glibc. Please post emerge --info
> and build.log from that system. It's unexpected to have build failures there.

Oh, I did not notice it's in the first half of that file. Looking.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2019-11-29 23:54:50 UTC
The x86_64 build failure is also musl-related:

"""
x86_64-gentoo-linux-musl-gcc -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"/usr/share/locale"' -I. -I/var/tmp/portage/dev-libs/elfutils-0.177/work/elfutils-0.177/lib -I..  -I. -I/var/tmp/portage/dev-libs/elfutils-0.177/work/elfutils-0.177/lib -I/var/tmp/portage/dev-libs/elfutils-0.177/work/elfutils-0.177/lib -I.. -I/var/tmp/portage/dev-libs/elfutils-0.177/work/elfutils-0.177/lib/../libelf -march=native -mtune=native -O2 -pipe -std=gnu99 -Wall -Wshadow -Wformat=2 -Wold-style-definition -Wstrict-prototypes -Wtrampolines -Wlogical-op -Wduplicated-cond -Wnull-dereference -Wimplicit-fallthrough=5  -Wunused -Wextra -Wstack-usage=262144   -fPIC -D_FORTIFY_SOURCE=2 -march=native -mtune=native -O2 -pipe -c -o xstrndup.o /var/tmp/portage/dev-libs/elfutils-0.177/work/elfutils-0.177/lib/xstrndup.c
In file included from /var/tmp/portage/dev-libs/elfutils-0.177/work/elfutils-0.177/lib/xstrndup.c:36:
/var/tmp/portage/dev-libs/elfutils-0.177/work/elfutils-0.177/lib/system.h:33:10: fatal error: error.h: No such file or directory
   33 | #include <error.h>
      |          ^~~~~~~~~
"""

There is no easy fix without backporting patches again. I strongly suggest working with upstream to merge explicit musl support.
Comment 5 Jory A. Pratt gentoo-dev 2019-11-30 00:39:27 UTC
(In reply to Lloyd from comment #1)
> Created attachment 597840 [details]
> emerge --info etc. all in one file

You are running an unsupported musl setup. The overlay should always have priority over everything. I am already working with upstream to address all the issues which is plenty.
Comment 6 Lloyd 2019-12-03 15:29:29 UTC
Thanks. musl-overlay has prio +50 versus -1000 the gentoo main repository. I've made a topic here: [url=https://forums.gentoo.org/viewtopic-t-1104918.html]Understanding Overlay Priorities[/url].
Comment 7 Anthony Basile gentoo-dev 2019-12-05 16:35:11 UTC
(In reply to Lloyd from comment #6)
> Thanks. musl-overlay has prio +50 versus -1000 the gentoo main repository.
> I've made a topic here:
> [url=https://forums.gentoo.org/viewtopic-t-1104918.html]Understanding
> Overlay Priorities[/url].

Make a pull request on https://github.com/gentoo/musl
Comment 8 Lloyd 2019-12-08 17:11:09 UTC
Thanks again. I made the following change to /etc/portage/package.accept_keywords, befor your post:

=dev-libs/elfutils-0.177 ~amd64

after that, the switch priority is working, and emerge Automatically pull the package from musl overlay instead of the gentoo main repository. In detail:
dev-libs/elfutils-0.177::musl is compiling without a problem. The case is closed for me.
I still have an understanding problem with main repository and overlays and priorities, but This I write in the forum:
https://forums.gentoo.org/viewtopic-t-1104918.html

bye.
Comment 9 Larry the Git Cow gentoo-dev 2020-03-21 10:37:24 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92db444e22b25bae835d273dc4e93d0d3534a0be

commit 92db444e22b25bae835d273dc4e93d0d3534a0be
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-03-21 10:32:04 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-03-21 10:37:18 +0000

    profiles/features/musl/package.mask: mask dev-libs/elfutils
    
    I'm specifically masking elfutils because it's a widespread
    dependency that pops up all the time when I try to build ::gentoo
    packages against musl profiles.
    
    In ::gentoo dev-libs/elfutils needs an upstream port to
    musl: #602126, #701478
    - https://sourceware.org/PR21002
    - https://sourceware.org/PR21008
    - https://sourceware.org/PR21010
    
    Overlays that carry out-of-tree patches can remove the mask
    via `profiles/package.mask`:
    
    ```
        # unmask in ::${overlay}
        -dev-libs/elfutils
    ```
    
    Bug: https://bugs.gentoo.org/602126
    Closes: https://bugs.gentoo.org/701478
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 profiles/features/musl/package.mask | 8 ++++++++
 1 file changed, 8 insertions(+)
Comment 10 Larry the Git Cow gentoo-dev 2021-11-07 06:44:22 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d465289bebb01cb8b90344996e9c4e0cd82b93eb

commit d465289bebb01cb8b90344996e9c4e0cd82b93eb
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-11-07 06:42:40 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-11-07 06:44:09 +0000

    dev-libs/elfutils: add musl support
    
    - Pull in patches and dependencies on libbsd and *-standalone from ::musl
    - Borrowed a patch or two from upstream elfutils (new release coming shortly)
      as well as Alpine Linux.
    
    Bug: https://bugs.gentoo.org/602126
    Bug: https://bugs.gentoo.org/701478
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/elfutils/elfutils-0.185.ebuild            | 10 +++
 .../elfutils/files/musl/elfutils-0.185-cdefs.patch | 20 ++++++
 .../files/musl/elfutils-0.185-error-h.patch        | 83 +++++++++++++++++++++
 .../files/musl/elfutils-0.185-macros.patch         | 84 ++++++++++++++++++++++
 .../files/musl/elfutils-0.185-strndupa.patch       | 20 ++++++
 profiles/features/musl/package.mask                |  8 ---
 6 files changed, 217 insertions(+), 8 deletions(-)