From a4957cb794dce725b4801ee16a36f38526bdce2d Mon Sep 17 00:00:00 2001 From: Sam James Date: Wed, 10 Nov 2021 03:31:26 +0000 Subject: sys-libs/musl: create relative symlink to libc.so if existing one fails The build system seems to create an absolute symlink to libc.so on the host which may not exist. If it doesn't (to avoid being disruptive, we could do this unconditionally), create a new one relative within ${D} to facilitate SYSROOT installs. I've hit this a few times when using crossdev but finally dug into it a bit more. Bug: https://bugs.gentoo.org/732482 Signed-off-by: Sam James --- sys-libs/musl/musl-9999.ebuild | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'sys-libs/musl/musl-9999.ebuild') diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild index 56a2bbbc42f6..5736eadc0fb4 100644 --- a/sys-libs/musl/musl-9999.ebuild +++ b/sys-libs/musl/musl-9999.ebuild @@ -3,7 +3,7 @@ EAPI=7 -inherit flag-o-matic toolchain-funcs +inherit eapi8-dosym flag-o-matic toolchain-funcs if [[ ${PV} == "9999" ]] ; then EGIT_REPO_URI="git://git.musl-libc.org/musl" inherit git-r3 @@ -120,7 +120,23 @@ src_install() { # SUBARCH = ... # and print $(ARCH)$(SUBARCH). local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak) - [[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die + + if [[ ! -e "${D}"/lib/ld-musl-${arch}.so.1 ]] ; then + # During cross (using crossdev), when emerging sys-libs/musl, + # if /usr/lib/libc.so.1 doesn't exist on the system, installation + # would fail. + # + # The musl build system seems to create a symlink: + # ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute) + # During cross, there's no guarantee that the host is using musl + # so that file may not exist. Use a relative symlink within ${D} + # instead. + dosym8 -r /usr/lib/libc.so.1 /lib/ld-musl-${arch}.so.1 + + # If it's still a dead symlnk, OK, we really do need to abort. + [[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die + fi + cp "${FILESDIR}"/ldconfig.in "${T}" || die sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die into / -- cgit v1.2.3-65-gdbad