There's several bugs and missing toggles in this package that prevent it from working within a prefix. This bug is essentially a plug for a pull request I'll submit in a second, as these things rarely get noticed otherwise. Using the patched ebuild I managed to build a working musl prefix, though the bootstrap process I used is a mess.
Thank you!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b02003640228503cb93d5c371bef1f55c555429f commit b02003640228503cb93d5c371bef1f55c555429f Author: Esteve Varela Colominas <esteve.varela@gmail.com> AuthorDate: 2022-02-12 15:34:33 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-02-20 00:29:46 +0000 sys-libs/musl: Support Gentoo prefix Added necessary framework to get this libc to run properly under a prefix. Closes: https://bugs.gentoo.org/833192 Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/24169 Signed-off-by: Sam James <sam@gentoo.org> sys-libs/musl/files/ldconfig.in-r3 | 160 +++++++++++++++++++++++++++++++++++++ sys-libs/musl/musl-1.2.2-r8.ebuild | 156 ++++++++++++++++++++++++++++++++++++ sys-libs/musl/musl-9999.ebuild | 44 +++++----- 3 files changed, 336 insertions(+), 24 deletions(-)