install: ship empty libcrypt.a and libutil.a compat archives

relibc implements crypt/crypt_r inside libc itself, but build systems still
pass -lcrypt because that is where glibc puts it. The link then fails even
though the symbols are present:
  ld: cannot find -lcrypt: No such file or directory
(KDE plasma-workspace kcms/users). nm confirms libc.a exports crypt and crypt_r.

Ships empty archives so -lcrypt and -lutil resolve and the symbols come from
libc -- the same approach musl takes, and the same pattern this Makefile
already uses for libdl, libpthread and librt.
This commit is contained in:
2026-08-04 22:24:45 +03:00
parent 4e9fbf4c38
commit ae06748508
+9 -1
View File
@@ -97,10 +97,18 @@ ifeq ($(USE_RUST_LIBM),)
else
$(AR) -rcs "$(DESTDIR)/lib/libm.a"
endif
# Empty libraries for dl, pthread, and rt
# Empty compatibility archives. relibc implements these APIs inside libc
# itself, but build systems still pass -ldl/-lpthread/-lrt/-lcrypt/-lutil
# because that is where glibc puts them. Shipping empty archives lets the
# link resolve and the symbols come from libc -- the same approach musl
# takes. Without libcrypt.a, KDE's kcm_users fails with
# ld: cannot find -lcrypt: No such file or directory
# even though libc.a exports both crypt and crypt_r.
$(AR) -rcs "$(DESTDIR)/lib/libdl.a"
$(AR) -rcs "$(DESTDIR)/lib/libpthread.a"
$(AR) -rcs "$(DESTDIR)/lib/librt.a"
$(AR) -rcs "$(DESTDIR)/lib/libcrypt.a"
$(AR) -rcs "$(DESTDIR)/lib/libutil.a"
install-tests: tests
$(MAKE) -C tests