[git commit] Makefile: add missing libraries to LDLIBS
Denys Vlasenko
vda.linux at googlemail.com
Mon Aug 17 15:05:55 UTC 2015
commit: http://git.busybox.net/busybox/commit/?id=bb2fd67d0bfe16441d4b1d2e6ece83b04955b379
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Static build with CONFIG_PAM fails on Debian Jessie due to undefined
references to libdl and libaudit.
Static build without pam, but with libcrypt required fails as well due
to undefined references to libpthread.
Fix these two cases by adding the missing libraries to LDLIBS when
appropriate.
Signed-off-by: Bartosz Golaszewski <bartekgola at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
Makefile.flags | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Makefile.flags b/Makefile.flags
index a1ed148..bb90a08 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -121,20 +121,20 @@ endif
# fall back to using a temp file:
CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >crypttest.c; $(CC) $(CFLAGS) -lcrypt -o /dev/null crypttest.c >/dev/null 2>&1 && echo "y"; rm crypttest.c)
ifeq ($(CRYPT_AVAILABLE),y)
-LDLIBS += m crypt
+LDLIBS += m crypt pthread
else
LDLIBS += m
endif
ifeq ($(CONFIG_PAM),y)
-# libpam uses libpthread, so for static builds busybox must be linked to
-# libpthread. On some platforms that requires an explicit -lpthread, so
-# it should be in LDLIBS. For non-static builds, scripts/trylink will
-# take care of removing -lpthread if possible. (Not bothering to check
-# CONFIG_STATIC because even in a non-static build it could be that the
-# only libpam available is libpam.a, so -lpthread could still be
-# needed.)
-LDLIBS += pam pam_misc pthread
+# libpam uses libpthread, libdl and libaudit, so for static builds busybox
+# must be linked to libpthread, libdl and libaudit. On some platforms that
+# requires an explicit -lpthread, -ldl and -laudit, so it should be in
+# LDLIBS. For non-static builds, scripts/trylink will take care of removing
+# these flags if possible. (Not bothering to check CONFIG_STATIC because
+# even in a non-static build it could be that the only libpam available is
+# libpam.a, so -lpthread & Co. could still be needed.)
+LDLIBS += pam pam_misc pthread dl audit
endif
ifeq ($(CONFIG_SELINUX),y)
More information about the busybox-cvs
mailing list