Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 832676

Summary: sys-devel/mold: fails to build with ELIBC=musl
Product: Gentoo Linux Reporter: Andrew Athalye <andrewathalye>
Component: Current packagesAssignee: Sam James <sam>
Status: RESOLVED UPSTREAM    
Severity: normal CC: herrtimson
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=832677
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Specifies that libucontext should be used to provide the necessary symbols on musl. This patch should be reworked to check if musl is being used, however in the interim it may fit in the musl overlay.

Description Andrew Athalye 2022-02-04 04:49:30 UTC
Created attachment 764311 [details, diff]
Specifies that libucontext should be used to provide the necessary symbols on musl. This patch should be reworked to check if musl is being used, however in the interim it may fit in the musl overlay.

Mold (1.0.2) currently fails to build on x86_64 musl due to the lack of getcontext/setcontext, which were deprecated as of POSIX 2008 and thus not included in musl. sys-libs/libucontext can be used to replace the missing functionality, however due to an unrelated issue that currently does not work as expected.

I have attached a simple patch which, after the libucontext issue is resolved, should enable mold to build successfully on musl. I have not yet had a chance to test whether linking works as expected, however the mold executable does work with this patch applied.
Comment 1 Andrew Athalye 2022-02-04 05:34:44 UTC
I've done some simple tests with a program that uses libcrypto and libc only, and it appears that mold works as expected with this patch.
Comment 2 Andrew Athalye 2022-02-04 13:39:11 UTC
It looks like upstream have merged a patch which makes the built-in oneTBB not require the context functions anymore, and oneTBB has also merged a pull request to not use context functions when libc is not glibc (https://github.com/rui314/mold/issues/281) (https://github.com/oneapi-src/oneTBB/pull/748/files). I'll mark this as resolved since only a tbb update / patch should be required from now on to make the build successful.
Comment 3 tt_1 2022-02-13 11:15:46 UTC
just wanted to ask, are you able to compile a working binary with the recent changes in dev-cpp/tbb and sys-devel/mold, on musl system? 

amd64 is working for me, but aarch64 isn't