AtlatestRepositorycore-channel

core-channel / tree / src / patchesmusl-relative-ldso-symlink.patch

1Make the dynamic-loader symlink RELATIVE to its own directory.
2
3musl installs lib/ld-musl-x86_64.so.1 as a symlink to $(libdir)/libc.so, an
4ABSOLUTE path. In this channel $(libdir) is the package's own store prefix,
5/sigil/store/<item>/lib, which exists only inside the build sandbox. The
6sandbox assembly runs on the HOST, before the chroot, so it must be able to
7resolve the loader from outside: an absolute self-referential symlink is
8dangling there and cannot be bind-mounted.
9
10A relative symlink names the sibling file and therefore resolves identically
11from both sides. Nothing else changes; the installed loader still points at
12the same libc.so.
14--- a/Makefile
15+++ b/Makefile
16@@ -210,7 +210,7 @@
17 $(INSTALL) -D -m 644 $< $@
19 $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
20- $(INSTALL) -D -l $(libdir)/libc.so $@ || true
21+ $(INSTALL) -D -l libc.so $@ || true
23 install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)