From 611ff617cf1b2e5ce313ebac82b5e3bee57eb1ac Mon Sep 17 00:00:00 2001 From: Stanislav Sedov Date: Tue, 27 Sep 2011 07:14:12 +0000 Subject: [PATCH] - Add missing interdependencies to kerberos libraries. Some of the kerberos libraries were not linked properly (missing dependencies), which causes 3rd party applications linking to fail when --as-needed ld flag is used. I also added the --no-undefined ld(1) flag to make sure that there're no missing dependencies. MFC after: 3 days --- Makefile.inc1 | 17 ++++++++++++++++- kerberos5/lib/libasn1/Makefile | 3 +++ kerberos5/lib/libgssapi_krb5/Makefile | 2 +- kerberos5/lib/libgssapi_ntlm/Makefile | 6 +++--- kerberos5/lib/libgssapi_spnego/Makefile | 6 +++--- kerberos5/lib/libhdb/Makefile | 3 +++ kerberos5/lib/libheimntlm/Makefile | 3 +++ kerberos5/lib/libhx509/Makefile | 3 +++ kerberos5/lib/libkadm5clnt/Makefile | 3 +++ kerberos5/lib/libkadm5srv/Makefile | 3 +++ kerberos5/lib/libkafs5/Makefile | 3 +++ kerberos5/lib/libkrb5/Makefile | 3 +++ kerberos5/lib/libroken/Makefile | 2 ++ tools/make_libdeps.sh | 2 +- 14 files changed, 50 insertions(+), 9 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 7228f859ce25..a59405095259 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1218,7 +1218,8 @@ _startup_libs+= lib/libc gnu/lib/libgcc__L: lib/libc__L -_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \ +_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \ + ${_kerberos5_lib_libheimntlm} \ ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ ${_kerberos5_lib_libroken} \ lib/libbz2 lib/libcom_err lib/libcrypt \ @@ -1268,6 +1269,19 @@ secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ _secure_lib= secure/lib .endif +.if ${MK_KERBEROS} != "no" +kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L +kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ + kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L +kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L +kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ + secure/lib/libcrypto__L kerberos5/lib/libroken__L +kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ + lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ + kerberos5/lib/libroken__L +kerberos5/lib/libroken__L: lib/libcrypt__L +.endif + .if ${MK_GSSAPI} != "no" _lib_libgssapi= lib/libgssapi .endif @@ -1279,6 +1293,7 @@ _lib_libipx= lib/libipx .if ${MK_KERBEROS} != "no" _kerberos5_lib= kerberos5/lib _kerberos5_lib_libasn1= kerberos5/lib/libasn1 +_kerberos5_lib_libhdb= kerberos5/lib/libhdb _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 _kerberos5_lib_libhx509= kerberos5/lib/libhx509 _kerberos5_lib_libroken= kerberos5/lib/libroken diff --git a/kerberos5/lib/libasn1/Makefile b/kerberos5/lib/libasn1/Makefile index 4a9c21ebfd2a..cf91a4bc8d7f 100644 --- a/kerberos5/lib/libasn1/Makefile +++ b/kerberos5/lib/libasn1/Makefile @@ -1,7 +1,10 @@ # $FreeBSD$ LIB= asn1 +LDFLAGS= -Wl,--no-undefined INCS= asn1_err.h heim_asn1.h +LDADD= -lcom_err -lroken +DPADD= ${LIBCOM_ERR} ${LIBROKEN} SRCS= asn1_err.c \ asn1_err.h \ diff --git a/kerberos5/lib/libgssapi_krb5/Makefile b/kerberos5/lib/libgssapi_krb5/Makefile index 6c2f4217b3c7..943e87572632 100644 --- a/kerberos5/lib/libgssapi_krb5/Makefile +++ b/kerberos5/lib/libgssapi_krb5/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ LIB= gssapi_krb5 -LDFLAGS= -Wl,-Bsymbolic +LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined LDADD= -lgssapi -lkrb5 -lhx509 -lcrypto -lroken -lasn1 -lcom_err -lcrypt DPADD= ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBCRYPTO} ${LIBROKEN} ${LIBASN1} \ ${LIBCOM_ERR} ${LIBCRYPT} diff --git a/kerberos5/lib/libgssapi_ntlm/Makefile b/kerberos5/lib/libgssapi_ntlm/Makefile index cbecc2d5ee93..98b47f716c24 100644 --- a/kerberos5/lib/libgssapi_ntlm/Makefile +++ b/kerberos5/lib/libgssapi_ntlm/Makefile @@ -1,9 +1,9 @@ # $FreeBSD$ LIB= gssapi_ntlm -LDFLAGS= -Wl,-Bsymbolic -LDADD= -lkrb5 -lhx509 -lheimntlm -lroken -DPADD= ${LIBKRB5} ${LIBHX509} ${LIBHEIMNTLM} ${LIBROKEN} +LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined +LDADD= -lcrypto -lgssapi -lkrb5 -lhx509 -lheimntlm -lroken +DPADD= ${LIBCRYPTO} ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBHEIMNTLM} ${LIBROKEN} SRCS= accept_sec_context.c \ acquire_cred.c \ diff --git a/kerberos5/lib/libgssapi_spnego/Makefile b/kerberos5/lib/libgssapi_spnego/Makefile index 32348ecf1ba5..ce44dbee2a7b 100644 --- a/kerberos5/lib/libgssapi_spnego/Makefile +++ b/kerberos5/lib/libgssapi_spnego/Makefile @@ -1,9 +1,9 @@ # $FreeBSD$ LIB= gssapi_spnego -LDFLAGS= -Wl,-Bsymbolic -LDADD= -lgssapi -lasn1 -DPADD= ${LIBGSSAPI} ${LIBASN1} +LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined +LDADD= -lgssapi -lasn1 -lroken +DPADD= ${LIBGSSAPI} ${LIBASN1} ${LIBROKEN} SRCS= accept_sec_context.c \ compat.c \ diff --git a/kerberos5/lib/libhdb/Makefile b/kerberos5/lib/libhdb/Makefile index 75465d3768d5..653690a1ff46 100644 --- a/kerberos5/lib/libhdb/Makefile +++ b/kerberos5/lib/libhdb/Makefile @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= hdb +LDFLAGS= -Wl,--no-undefined +LDADD= -lasn1 -lcom_err -lkrb5 -lroken +DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBKRB5} ${LIBROKEN} INCS= hdb-private.h \ hdb-protos.h \ diff --git a/kerberos5/lib/libheimntlm/Makefile b/kerberos5/lib/libheimntlm/Makefile index e223258a50fa..ba7c922d642e 100644 --- a/kerberos5/lib/libheimntlm/Makefile +++ b/kerberos5/lib/libheimntlm/Makefile @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= heimntlm +LDFLAGS= -Wl,--no-undefined +LDADD= -lcrypto -lkrb5 +DPADD= ${LIBCRYPTO} ${LIBKRB5} SRCS= ntlm.c INCS= heimntlm.h heimntlm-protos.h CFLAGS+=-I${KRB5DIR}/lib/ntlm diff --git a/kerberos5/lib/libhx509/Makefile b/kerberos5/lib/libhx509/Makefile index e94831aaca73..9238a74bc96d 100644 --- a/kerberos5/lib/libhx509/Makefile +++ b/kerberos5/lib/libhx509/Makefile @@ -1,7 +1,10 @@ # $FreeBSD$ LIB= hx509 +LDFLAGS= -Wl,--no-undefined VERSION_MAP= ${KRB5DIR}/lib/hx509/version-script.map +LDADD= -lasn1 -lcom_err -lcrypto -lroken +DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBCRYPTO} ${LIBROKEN} INCS= hx509-private.h \ hx509-protos.h \ diff --git a/kerberos5/lib/libkadm5clnt/Makefile b/kerberos5/lib/libkadm5clnt/Makefile index 339086686613..dd93847e335f 100644 --- a/kerberos5/lib/libkadm5clnt/Makefile +++ b/kerberos5/lib/libkadm5clnt/Makefile @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= kadm5clnt +LDFLAGS= -Wl,--no-undefined +LDADD= -lcom_err -lkrb5 -lroken +DPADD= ${LIBCOM_ERR} ${LIBKRB5} ${LIBROKEN} INCS= admin.h \ kadm5-private.h \ diff --git a/kerberos5/lib/libkadm5srv/Makefile b/kerberos5/lib/libkadm5srv/Makefile index c0be47763673..43bd6e07cc75 100644 --- a/kerberos5/lib/libkadm5srv/Makefile +++ b/kerberos5/lib/libkadm5srv/Makefile @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= kadm5srv +LDFLAGS= -Wl,--no-undefined +LDADD= -lcom_err -lhdb -lkrb5 -lroken +DPADD= ${LIBCOM_ERR} ${LIBHDB} ${LIBKRB5} ${LIBROKEN} VERSION_MAP= ${KRB5DIR}/lib/kadm5/version-script.map SRCS= acl.c \ diff --git a/kerberos5/lib/libkafs5/Makefile b/kerberos5/lib/libkafs5/Makefile index e0e0b3036a5e..962a900bd9cf 100644 --- a/kerberos5/lib/libkafs5/Makefile +++ b/kerberos5/lib/libkafs5/Makefile @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= kafs5 +LDFLAGS= -Wl,--no-undefined +LDADD= -lasn1 -lkrb5 -lroken +DPADD= ${LIBASN1} ${LIBKRB5} ${LIBROKEN} INCS= kafs.h MAN= kafs5.3 diff --git a/kerberos5/lib/libkrb5/Makefile b/kerberos5/lib/libkrb5/Makefile index 29653388b1c6..71175cdad518 100644 --- a/kerberos5/lib/libkrb5/Makefile +++ b/kerberos5/lib/libkrb5/Makefile @@ -1,7 +1,10 @@ # $FreeBSD$ LIB= krb5 +LDFLAGS= -Wl,--no-undefined VERSION_MAP= ${KRB5DIR}/lib/krb5/version-script.map +LDADD= -lasn1 -lcom_err -lcrypt -lcrypto -lhx509 -lroken +DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBCRYPT} ${LIBCRYPTO} ${LIBHX509} ${LIBROKEN} INCS= heim_err.h \ heim_threads.h \ diff --git a/kerberos5/lib/libroken/Makefile b/kerberos5/lib/libroken/Makefile index 92f38a8447b8..c88e1ce9f7e1 100644 --- a/kerberos5/lib/libroken/Makefile +++ b/kerberos5/lib/libroken/Makefile @@ -1,6 +1,8 @@ # $FreeBSD$ LIB= roken +LDADD= -lcrypt +DPADD= ${LIBCRYPT} INCS= roken.h roken-common.h SRCS= base64.c \ diff --git a/tools/make_libdeps.sh b/tools/make_libdeps.sh index b0b3f186b1ac..608422aeab8d 100644 --- a/tools/make_libdeps.sh +++ b/tools/make_libdeps.sh @@ -52,7 +52,7 @@ sed -E -e's;-l(ncurses|termcap)!;lib/ncurses/ncurses;g' -e's;-l(gcc)!;gnu/lib/lib\1;g' -e's;-lssp_nonshared!;gnu/lib/libssp/libssp_nonshared;g' - -e's;-l(asn1|heimntlm|hx509|krb5|roken)!;kerberos5/lib/lib\1;g' + -e's;-l(asn1|hdb|heimntlm|hx509|krb5|roken)!;kerberos5/lib/lib\1;g' -e's;-l(crypto|ssh|ssl)!;secure/lib/lib\1;g' -e's;-l([^!]+)!;lib/lib\1;g' "