Skip Menu |
 

Download (untitled) / with headers
text/plain 22.6KiB
From smichaud@pobox.com Fri Apr 18 17:42:25 2003
Received: from fort-point-station.mit.edu (FORT-POINT-STATION.MIT.EDU [18.7.7.76]) by krbdev.mit.edu (8.9.3) with ESMTP
id RAA06831; Fri, 18 Apr 2003 17:42:25 -0400 (EDT)
Received: from flanders.mynet.net (adsl-68-78-102-225.dsl.emhril.ameritech.net [68.78.102.225])
by fort-point-station.mit.edu (8.12.4/8.9.2) with ESMTP id h3ILgNBb009368
for <krb5-bugs@mit.edu>; Fri, 18 Apr 2003 17:42:24 -0400 (EDT)
Received: from flanders.mynet.net (localhost [127.0.0.1])
by flanders.mynet.net (8.12.9/8.12.9) with ESMTP id h3ILgNkB000586
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
for <krb5-bugs@mit.edu>; Fri, 18 Apr 2003 16:42:23 -0500 (CDT)
Received: from localhost (smichaud@localhost)
by flanders.mynet.net (8.12.9/8.12.9/Submit) with ESMTP id h3ILgNZQ000583
for <krb5-bugs@mit.edu>; Fri, 18 Apr 2003 16:42:23 -0500 (CDT)
Date: Fri, 18 Apr 2003 16:42:23 -0500 (CDT)
From: Steven Michaud <smichaud@pobox.com>
X-X-Sender: smichaud@flanders.mynet.net
To: krb5-bugs@mit.edu
Subject: Kerberos programs link to installed libraries
Message-ID: <Pine.GSO.4.53.0304181640120.580@flanders.mynet.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

Show quoted text
>Submitter-Id: net
>Originator:
>Organization:
>Confidential: no
>Synopsis: Kerberos programs link to installed libraries
>Severity: serious
>Priority: medium
>Category: krb5-build
>Class: sw-bug
>Release: krb5-1.3-alpha2
>Environment:
System: Darwin swann.mynet.net 6.5 Darwin Kernel Version 6.5: Mon Apr 7 17:05:38 PDT 2003; root:xnu/xnu-344.32.obj~1/RELEASE_PPC Power Macintosh powerpc

Show quoted text
>Description:

When building Kerberos, the components are (usually) linked
preferentially to libraries that are already installed, instead of to
the libraries that are built as part of the current build process.
(This is true if the installed libraries are located in any of the
standard library directories -- /usr/lib and /usr/local/lib.)

To illustrate the problem, here's how src/lib/rpc/unit-test/client
normally gets linked:

gcc -L../../../lib -g -O2 [...] -o client client.o rpc_test_clnt.o \
-lgssrpc -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err

Though the directory where the current build's libraries are located
is (correctly) specified with the -L parameter, use of the -l flag
means that this directory is only searched after the standard library
directories have been searched.

Here are better solutions (one for static libraries and the other for
dynamic libraries):

gcc -g -O2 [...] -o client client.o rpc_test_clnt.o \
../../../lib/libgssrpc.a ../../../lib/libgssapi_krb5.a \
../../../lib/libkrb5.a ../../../lib/libk5crypto.a \
../../../lib/libcom_err.a

gcc -dynamic -g -O2 [...] -o client client.o rpc_test_clnt.o \
../../../lib/libgssrpc.dylib ../../../lib/libgssapi_krb5.dylib \
../../../lib/libkrb5.dylib ../../../lib/libk5crypto.dylib \
../../../lib/libcom_err.dylib

This problem has existed since at least release 1.0.5. Though
annoying, on most OSs it's been possible to live with -- you just need
to install twice. But it's a major headache on Mac OS X, which comes
with a set of MIT Kerberos libraries that you can't rebuild, and which
are missing a bunch of symbols present in the Unix libraries.

Show quoted text
>How-To-Repeat:
>Fix:

I've written a patch that sets the values of the Makefile variables
such as KRB5_LIB and K5CRYPTO_LIB to their "DEPLIB" equivalents. As
far as I can tell, doing this has only one side-effect -- it breaks
krb5-config. But that's easily fixed by adding a couple more
Makefile/autoconf variables -- KRB4_LIB_CONF and DES425_LIB_CONF.

To get the shared libraries to build, I had to make some additional
changes to the way libk5crypto is built -- it's not true that it has
"no dependencies", since it needs to link against libcom_err.

Here's my patch:

diff -c -r src.old/aclocal.m4 src/aclocal.m4
*** src.old/aclocal.m4 Fri Apr 18 15:23:50 2003
--- src/aclocal.m4 Fri Apr 18 15:26:38 2003
***************
*** 391,396 ****
--- 391,397 ----
if test $withval = no; then
AC_MSG_RESULT(no krb4 support)
KRB4_LIB=
+ KRB4_LIB_CONF=
KRB4_DEPLIB=
KRB4_INCLUDES=
KRB4_LIBPATH=
***************
*** 406,412 ****
if test $withval = yes; then
AC_MSG_RESULT(built in krb4 support)
KRB4_DEPLIB='$(TOPLIBD)/libkrb4$(DEPLIBEXT)'
! KRB4_LIB=-lkrb4
KRB4_INCLUDES='-I$(SRCTOP)/include/kerberosIV -I$(BUILDTOP)/include/kerberosIV'
KRB4_LIBPATH=
KRB524_DEPLIB='$(BUILDTOP)/krb524/libkrb524.a'
--- 407,414 ----
if test $withval = yes; then
AC_MSG_RESULT(built in krb4 support)
KRB4_DEPLIB='$(TOPLIBD)/libkrb4$(DEPLIBEXT)'
! KRB4_LIB='$(KRB4_DEPLIB)'
! KRB4_LIB_CONF="-lkrb4"
KRB4_INCLUDES='-I$(SRCTOP)/include/kerberosIV -I$(BUILDTOP)/include/kerberosIV'
KRB4_LIBPATH=
KRB524_DEPLIB='$(BUILDTOP)/krb524/libkrb524.a'
***************
*** 419,424 ****
--- 421,427 ----
else
AC_MSG_RESULT(preinstalled krb4 in $withval)
KRB4_LIB="-lkrb"
+ KRB4_LIB_CONF="-lkrb"
dnl DEPKRB4_LIB="$withval/lib/libkrb.a"
KRB4_INCLUDES="-I$withval/include"
KRB4_LIBPATH="-L$withval/lib"
***************
*** 432,437 ****
--- 435,441 ----
AC_SUBST(KRB4_INCLUDES)
AC_SUBST(KRB4_LIBPATH)
AC_SUBST(KRB4_LIB)
+ AC_SUBST(KRB4_LIB_CONF)
AC_SUBST(KRB4_DEPLIB)
AC_SUBST(KRB524_DEPLIB)
AC_SUBST(KRB524_LIB)
***************
*** 440,447 ****
AC_SUBST(KRB524_ERR_H_DEP)
dnl We always compile the des425 library
DES425_DEPLIB='$(TOPLIBD)/libdes425$(DEPLIBEXT)'
! DES425_LIB=-ldes425
AC_SUBST(DES425_DEPLIB)
AC_SUBST(DES425_LIB)
])dnl
dnl
--- 444,453 ----
AC_SUBST(KRB524_ERR_H_DEP)
dnl We always compile the des425 library
DES425_DEPLIB='$(TOPLIBD)/libdes425$(DEPLIBEXT)'
! DES425_LIB='$(DES425_DEPLIB)'
! DES425_LIB_CONF="-ldes425"
AC_SUBST(DES425_DEPLIB)
+ AC_SUBST(DES425_LIB_CONF)
AC_SUBST(DES425_LIB)
])dnl
dnl
diff -c -r src.old/config/pre.in src/config/pre.in
*** src.old/config/pre.in Fri Apr 18 15:23:31 2003
--- src/config/pre.in Fri Apr 18 15:23:11 2003
***************
*** 336,349 ****
SS_LIB = $(SS_LIB-@SS_VERSION@)
SS_LIB-sys = @SS_LIB@
SS_LIB-k5 = $(TOPLIBD)/libss.a
! KDB5_LIB = -lkdb5
DB_LIB = @DB_LIB@
KDB5_DB_LIB = @KDB5_DB_LIB@

! KRB5_LIB = -lkrb5
! K5CRYPTO_LIB = -lk5crypto
! COM_ERR_LIB = -lcom_err
! GSS_KRB5_LIB = -lgssapi_krb5

# KRB4_LIB is -lkrb4 if building --with-krb4
# needs fixing if ever used on Mac OS X!
--- 336,349 ----
SS_LIB = $(SS_LIB-@SS_VERSION@)
SS_LIB-sys = @SS_LIB@
SS_LIB-k5 = $(TOPLIBD)/libss.a
! KDB5_LIB = $(KDB5_DEPLIB)
DB_LIB = @DB_LIB@
KDB5_DB_LIB = @KDB5_DB_LIB@

! KRB5_LIB = $(KRB5_DEPLIB)
! K5CRYPTO_LIB = $(CRYPTO_DEPLIB)
! COM_ERR_LIB = $(COM_ERR_DEPLIB-k5)
! GSS_KRB5_LIB = $(GSS_DEPLIB)

# KRB4_LIB is -lkrb4 if building --with-krb4
# needs fixing if ever used on Mac OS X!
***************
*** 360,378 ****
# HESIOD_LIBS is -lhesiod...
HESIOD_LIBS = @HESIOD_LIBS@

! KRB5_BASE_LIBS = $(KRB5_LIB) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(GEN_LIB) $(LIBS)
KRB4COMPAT_LIBS = $(KRB4_LIB) $(DES425_LIB) $(KRB5_BASE_LIBS)
KDB5_LIBS = $(KDB5_LIB) $(KDB5_DB_LIB)
GSS_LIBS = $(GSS_KRB5_LIB)
# needs fixing if ever used on Mac OS X!
! GSSRPC_LIBS = -lgssrpc $(GSS_LIBS)
KADM_COMM_LIBS = $(GSSRPC_LIBS)
# need fixing if ever used on Mac OS X!
! KADMSRV_LIBS = -lkadm5srv $(HESIOD_LIBS) $(KDB5_LIBS) $(KADM_COMM_LIBS)
! KADMCLNT_LIBS = -lkadm5clnt $(KADM_COMM_LIBS)

# need fixing if ever used on Mac OS X!
! PTY_LIB = -lpty

#
# some more stuff for --with-krb4
--- 360,378 ----
# HESIOD_LIBS is -lhesiod...
HESIOD_LIBS = @HESIOD_LIBS@

! KRB5_BASE_LIBS = $(KRB5_LIB) $(K5CRYPTO_LIB) $(GEN_LIB) $(LIBS) $(COM_ERR_LIB)
KRB4COMPAT_LIBS = $(KRB4_LIB) $(DES425_LIB) $(KRB5_BASE_LIBS)
KDB5_LIBS = $(KDB5_LIB) $(KDB5_DB_LIB)
GSS_LIBS = $(GSS_KRB5_LIB)
# needs fixing if ever used on Mac OS X!
! GSSRPC_LIBS = $(GSSRPC_DEPLIB) $(GSS_LIBS)
KADM_COMM_LIBS = $(GSSRPC_LIBS)
# need fixing if ever used on Mac OS X!
! KADMSRV_LIBS = $(KADMSRV_DEPLIB) $(HESIOD_LIBS) $(KDB5_LIBS) $(KADM_COMM_LIBS)
! KADMCLNT_LIBS = $(KADMCLNT_DEPLIB) $(KADM_COMM_LIBS)

# need fixing if ever used on Mac OS X!
! PTY_LIB = $(PTY_DEPLIB)

#
# some more stuff for --with-krb4
diff -c -r src.old/config/shlib.conf src/config/shlib.conf
*** src.old/config/shlib.conf Fri Apr 18 15:23:31 2003
--- src/config/shlib.conf Fri Apr 18 15:23:12 2003
***************
*** 212,218 ****
SHLIBSEXT='.$(LIBMAJOR).dylib'
SHLIB_EXPFLAGS='$(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
SHLIBEXT=.dylib
! LDCOMBINE='$(CC) -undefined warning -dynamiclib -compatibility_version $(LIBMAJOR) -current_version $(LIBMAJOR).$(LIBMINOR) -install_name "$(KRB5_LIBDIR)/lib$(LIB)$(SHLIBVEXT)" $(CFLAGS) $(LDFLAGS)'
CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -dynamic $(CFLAGS) $(LDFLAGS)'
CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)'
RUN_ENV='DYLD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export DYLD_LIBRARY_PATH;'
--- 212,218 ----
SHLIBSEXT='.$(LIBMAJOR).dylib'
SHLIB_EXPFLAGS='$(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
SHLIBEXT=.dylib
! LDCOMBINE='$(CC) -bind_at_load -dynamiclib -compatibility_version $(LIBMAJOR) -current_version $(LIBMAJOR).$(LIBMINOR) -install_name "$(KRB5_LIBDIR)/lib$(LIB)$(SHLIBVEXT)" $(CFLAGS) $(LDFLAGS)'
CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -dynamic $(CFLAGS) $(LDFLAGS)'
CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)'
RUN_ENV='DYLD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export DYLD_LIBRARY_PATH;'
diff -c -r src.old/krb5-config.in src/krb5-config.in
*** src.old/krb5-config.in Fri Apr 18 15:23:50 2003
--- src/krb5-config.in Fri Apr 18 15:23:30 2003
***************
*** 32,39 ****
includedir=@includedir@
libdir=@libdir@
CC_LINK='@CC_LINK@'
! KRB4_LIB=@KRB4_LIB@
! DES425_LIB=@DES425_LIB@
KDB5_DB_LIB=@KDB5_DB_LIB@
LDFLAGS='@LDFLAGS@'
RPATH_FLAG='@RPATH_FLAG@'
--- 32,39 ----
includedir=@includedir@
libdir=@libdir@
CC_LINK='@CC_LINK@'
! KRB4_LIB=@KRB4_LIB_CONF@
! DES425_LIB=@DES425_LIB_CONF@
KDB5_DB_LIB=@KDB5_DB_LIB@
LDFLAGS='@LDFLAGS@'
RPATH_FLAG='@RPATH_FLAG@'
diff -c -r src.old/lib/crypto/Makefile.in src/lib/crypto/Makefile.in
*** src.old/lib/crypto/Makefile.in Fri Apr 18 15:23:37 2003
--- src/lib/crypto/Makefile.in Fri Apr 18 15:23:17 2003
***************
*** 135,140 ****
--- 135,145 ----
LIBMAJOR=3
LIBMINOR=0
RELDIR=crypto
+ SHLIB_EXPDEPS = \
+ $(COM_ERR_DEPLIB)
+ SHLIB_EXPLIBS= $(LIBS) $(COM_ERR_LIB)
+ SHLIB_DIRS=-L$(TOPLIBD)
+ SHLIB_RDIRS=$(KRB5_LIBDIR)

STOBJLISTS=crc32/OBJS.ST des/OBJS.ST dk/OBJS.ST enc_provider/OBJS.ST \
hash_provider/OBJS.ST keyhash_provider/OBJS.ST md4/OBJS.ST \
***************
*** 148,160 ****
aes/OBJS.ST \
yarrow/OBJS.ST

- # No dependencies. Record places to find this shared object if the target
- # link editor and loader support it.
- DEPLIBS=
- SHLIB_LIBS=
- SHLIB_LDFLAGS= $(LDFLAGS) @SHLIB_RPATH_DIRS@
- SHLIB_LIBDIRS= @SHLIB_LIBDIRS@
-
##DOS##LIBOBJS = $(OBJS)

all-unix:: all-liblinks
--- 153,158 ----
***************
*** 178,187 ****
$(CC_LINK) -o $@ t_nfold.$(OBJEXT) nfold.$(OBJEXT)

t_encrypt$(EXEEXT): t_encrypt.$(OBJEXT) nfold.$(OBJEXT)
! $(CC_LINK) -o $@ t_encrypt.$(OBJEXT) -lkrb5 -lk5crypto -lcom_err

t_prng$(EXEEXT): t_prng.$(OBJEXT)
! $(CC_LINK) -o $@ t_prng.$(OBJEXT) -lk5crypto -lcom_err

t_hmac$(EXEEXT): t_hmac.$(OBJEXT) $(CRYPTO_DEPLIB)
$(CC_LINK) -o $@ t_hmac.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB)
--- 176,185 ----
$(CC_LINK) -o $@ t_nfold.$(OBJEXT) nfold.$(OBJEXT)

t_encrypt$(EXEEXT): t_encrypt.$(OBJEXT) nfold.$(OBJEXT)
! $(CC_LINK) -o $@ t_encrypt.$(OBJEXT) $(KRB5_BASE_LIBS)

t_prng$(EXEEXT): t_prng.$(OBJEXT)
! $(CC_LINK) -o $@ t_prng.$(OBJEXT) $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)

t_hmac$(EXEEXT): t_hmac.$(OBJEXT) $(CRYPTO_DEPLIB)
$(CC_LINK) -o $@ t_hmac.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB)
diff -c -r src.old/lib/crypto/aes/Makefile.in src/lib/crypto/aes/Makefile.in
*** src.old/lib/crypto/aes/Makefile.in Fri Apr 18 15:23:33 2003
--- src/lib/crypto/aes/Makefile.in Fri Apr 18 15:23:13 2003
***************
*** 54,60 ****
check:: run-aes-gen

aes-test: aes-test.$(OBJEXT) $(CRYPTO_DEPLIB)
! $(CC_LINK) -o aes-test aes-test.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB)

check:: run-aes-test
run-aes-test: aes-test
--- 54,60 ----
check:: run-aes-gen

aes-test: aes-test.$(OBJEXT) $(CRYPTO_DEPLIB)
! $(CC_LINK) -o aes-test aes-test.$(OBJEXT) $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)

check:: run-aes-test
run-aes-test: aes-test
diff -c -r src.old/lib/crypto/configure.in src/lib/crypto/configure.in
*** src.old/lib/crypto/configure.in Fri Apr 18 15:23:36 2003
--- src/lib/crypto/configure.in Fri Apr 18 15:23:17 2003
***************
*** 6,12 ****
KRB5_RUN_FLAGS
KRB5_BUILD_PROGRAM
KRB5_BUILD_LIBOBJS
! KRB5_BUILD_LIBRARY

dnl XXX This will go away soon. -- tlyu
AC_ARG_ENABLE([athena],
--- 6,12 ----
KRB5_RUN_FLAGS
KRB5_BUILD_PROGRAM
KRB5_BUILD_LIBOBJS
! KRB5_BUILD_LIBRARY_WITH_DEPS

dnl XXX This will go away soon. -- tlyu
AC_ARG_ENABLE([athena],
diff -c -r src.old/lib/crypto/des/Makefile.in src/lib/crypto/des/Makefile.in
*** src.old/lib/crypto/des/Makefile.in Fri Apr 18 15:23:34 2003
--- src/lib/crypto/des/Makefile.in Fri Apr 18 15:23:14 2003
***************
*** 64,70 ****
verify$(EXEEXT): t_verify.$(OBJEXT) $(TOBJS) f_parity.$(OBJEXT) \
$(COM_ERR_DEPLIB)
$(CC_LINK) -o $@ t_verify.$(OBJEXT) $(TOBJS) f_parity.$(OBJEXT) \
! -lcom_err

destest$(EXEEXT): destest.$(OBJEXT) $(TOBJS)
$(CC_LINK) -o $@ destest.$(OBJEXT) $(TOBJS)
--- 64,70 ----
verify$(EXEEXT): t_verify.$(OBJEXT) $(TOBJS) f_parity.$(OBJEXT) \
$(COM_ERR_DEPLIB)
$(CC_LINK) -o $@ t_verify.$(OBJEXT) $(TOBJS) f_parity.$(OBJEXT) \
! $(LIBS) $(COM_ERR_LIB)

destest$(EXEEXT): destest.$(OBJEXT) $(TOBJS)
$(CC_LINK) -o $@ destest.$(OBJEXT) $(TOBJS)
***************
*** 74,80 ****
afsstring2key.$(OBJEXT) f_parity.$(OBJEXT) weak_key.$(OBJEXT)

t_afss2k$(EXEEXT): $(TAFSS2KOBJS) $(COM_ERR_DEPLIB)
! $(CC_LINK) -o $@ $(TAFSS2KOBJS) -lcom_err

check-unix:: verify destest t_afss2k
$(RUN_SETUP) ./verify -z
--- 74,80 ----
afsstring2key.$(OBJEXT) f_parity.$(OBJEXT) weak_key.$(OBJEXT)

t_afss2k$(EXEEXT): $(TAFSS2KOBJS) $(COM_ERR_DEPLIB)
! $(CC_LINK) -o $@ $(TAFSS2KOBJS) $(LIBS) $(COM_ERR_LIB)

check-unix:: verify destest t_afss2k
$(RUN_SETUP) ./verify -z
diff -c -r src.old/lib/crypto/keyhash_provider/Makefile.in src/lib/crypto/keyhash_provider/Makefile.in
*** src.old/lib/crypto/keyhash_provider/Makefile.in Fri Apr 18 15:23:35 2003
--- src/lib/crypto/keyhash_provider/Makefile.in Fri Apr 18 15:23:15 2003
***************
*** 37,46 ****
$(CC) -DMD=5 $(ALL_CFLAGS) -o t_cksum5.o -c $(srcdir)/t_cksum.c

t_cksum4: t_cksum4.o $(CRYTPO_DEPLIB)
! $(CC_LINK) -o t_cksum4 t_cksum4.o $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(LIBS)

t_cksum5: t_cksum5.o $(CRYPTO_DEPLIB)
! $(CC_LINK) -o t_cksum5 t_cksum5.o $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(LIBS)

check-unix:: t_cksum4 t_cksum5
$(RUN_SETUP) $(C)t_cksum4 "this is a test"
--- 37,46 ----
$(CC) -DMD=5 $(ALL_CFLAGS) -o t_cksum5.o -c $(srcdir)/t_cksum.c

t_cksum4: t_cksum4.o $(CRYTPO_DEPLIB)
! $(CC_LINK) -o t_cksum4 t_cksum4.o $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)

t_cksum5: t_cksum5.o $(CRYPTO_DEPLIB)
! $(CC_LINK) -o t_cksum5 t_cksum5.o $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)

check-unix:: t_cksum4 t_cksum5
$(RUN_SETUP) $(C)t_cksum4 "this is a test"
diff -c -r src.old/lib/des425/Makefile.in src/lib/des425/Makefile.in
*** src.old/lib/des425/Makefile.in Fri Apr 18 15:23:38 2003
--- src/lib/des425/Makefile.in Fri Apr 18 15:23:18 2003
***************
*** 23,29 ****
SHLIB_EXPDEPS = \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(TOPLIBD)/libkrb5$(SHLIBEXT)
! SHLIB_EXPLIBS=-lkrb5 -lcom_err -lk5crypto
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

--- 23,29 ----
SHLIB_EXPDEPS = \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(TOPLIBD)/libkrb5$(SHLIBEXT)
! SHLIB_EXPLIBS=$(KRB5_LIB) $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

diff -c -r src.old/lib/gssapi/Makefile.in src/lib/gssapi/Makefile.in
*** src.old/lib/gssapi/Makefile.in Fri Apr 18 15:23:39 2003
--- src/lib/gssapi/Makefile.in Fri Apr 18 15:23:19 2003
***************
*** 31,37 ****
$(TOPLIBD)/libkrb5$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS=-lkrb5 -lk5crypto -lcom_err
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
RELDIR=gssapi
--- 31,37 ----
$(TOPLIBD)/libkrb5$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS=$(KRB5_LIB) $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
RELDIR=gssapi
diff -c -r src.old/lib/kadm5/clnt/Makefile.in src/lib/kadm5/clnt/Makefile.in
*** src.old/lib/kadm5/clnt/Makefile.in Fri Apr 18 15:23:40 2003
--- src/lib/kadm5/clnt/Makefile.in Fri Apr 18 15:23:20 2003
***************
*** 14,20 ****
$(TOPLIBD)/libkrb5$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS=-lgssrpc -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
RELDIR=kadm5/clnt
--- 14,20 ----
$(TOPLIBD)/libkrb5$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS=$(GSSRPC_LIBS) $(KRB5_LIB) $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
RELDIR=kadm5/clnt
diff -c -r src.old/lib/kadm5/srv/Makefile.in src/lib/kadm5/srv/Makefile.in
*** src.old/lib/kadm5/srv/Makefile.in Fri Apr 18 15:23:41 2003
--- src/lib/kadm5/srv/Makefile.in Fri Apr 18 15:23:21 2003
***************
*** 20,27 ****
$(TOPLIBD)/libkrb5$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS = -lgssrpc -lgssapi_krb5 -lkdb5 $(KDB5_DB_LIB) \
! -lkrb5 -lk5crypto -lcom_err @GEN_LIB@
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
RELDIR=kadm5/srv
--- 20,27 ----
$(TOPLIBD)/libkrb5$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS = $(GSSRPC_LIBS) $(KDB5_LIBS) \
! $(KRB5_LIB) $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
RELDIR=kadm5/srv
diff -c -r src.old/lib/kdb/Makefile.in src/lib/kdb/Makefile.in
*** src.old/lib/kdb/Makefile.in Fri Apr 18 15:23:43 2003
--- src/lib/kdb/Makefile.in Fri Apr 18 15:23:23 2003
***************
*** 16,22 ****
SHLIB_EXPDEPS = \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(TOPLIBD)/libkrb5$(SHLIBEXT)
! SHLIB_EXPLIBS=-lkrb5 -lcom_err -lk5crypto $(KDB5_DB_LIB) $(LIBS)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

--- 16,22 ----
SHLIB_EXPDEPS = \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(TOPLIBD)/libkrb5$(SHLIBEXT)
! SHLIB_EXPLIBS=$(KRB5_LIB) $(K5CRYPTO_LIB) $(KDB5_DB_LIB) $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

diff -c -r src.old/lib/krb4/Makefile.in src/lib/krb4/Makefile.in
*** src.old/lib/krb4/Makefile.in Fri Apr 18 15:23:44 2003
--- src/lib/krb4/Makefile.in Fri Apr 18 15:23:24 2003
***************
*** 18,30 ****
# Depends on libkrb5, expect to find
# krb5_init_context, krb5_free_context, profile_get_values
#
! KRB4_CRYPTO_LIBS=-ldes425

SHLIB_EXPDEPS = \
$(TOPLIBD)/libdes425$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(TOPLIBD)/libkrb5$(SHLIBEXT)
! SHLIB_EXPLIBS=-lkrb5 -lcom_err -ldes425 -lk5crypto
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

--- 18,30 ----
# Depends on libkrb5, expect to find
# krb5_init_context, krb5_free_context, profile_get_values
#
! KRB4_CRYPTO_LIBS=$(DES425_LIB)

SHLIB_EXPDEPS = \
$(TOPLIBD)/libdes425$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(TOPLIBD)/libkrb5$(SHLIBEXT)
! SHLIB_EXPLIBS=$(KRB5_LIB) $(DES425_LIB) $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

diff -c -r src.old/lib/krb5/Makefile.in src/lib/krb5/Makefile.in
*** src.old/lib/krb5/Makefile.in Fri Apr 18 15:23:45 2003
--- src/lib/krb5/Makefile.in Fri Apr 18 15:23:25 2003
***************
*** 52,58 ****
SHLIB_EXPDEPS = \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS=-lk5crypto -lcom_err @GEN_LIB@ $(LIBS)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

--- 52,58 ----
SHLIB_EXPDEPS = \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS=$(K5CRYPTO_LIB) @GEN_LIB@ $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

diff -c -r src.old/lib/rpc/Makefile.in src/lib/rpc/Makefile.in
*** src.old/lib/rpc/Makefile.in Fri Apr 18 15:23:46 2003
--- src/lib/rpc/Makefile.in Fri Apr 18 15:23:26 2003
***************
*** 16,22 ****
$(TOPLIBD)/libkrb5$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS=-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
RELDIR=rpc
--- 16,22 ----
$(TOPLIBD)/libkrb5$(SHLIBEXT) \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS=$(GSS_LIBS) $(KRB5_LIB) $(K5CRYPTO_LIB) $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
RELDIR=rpc
diff -c -r src.old/util/profile/Makefile.in src/util/profile/Makefile.in
*** src.old/util/profile/Makefile.in Fri Apr 18 15:23:47 2003
--- src/util/profile/Makefile.in Fri Apr 18 15:23:28 2003
***************
*** 38,50 ****
EXTRADEPSRCS=$(srcdir)/test_parse.c $(srcdir)/test_profile.c

DEPLIBS = $(COM_ERR_DEPLIB)
! MLIBS = -lcom_err

LIB=profile
LIBMAJOR=1
LIBMINOR=1
SHLIB_EXPDEPS = $(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS = -lcom_err
SHLIB_DIRS = -L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

--- 38,50 ----
EXTRADEPSRCS=$(srcdir)/test_parse.c $(srcdir)/test_profile.c

DEPLIBS = $(COM_ERR_DEPLIB)
! MLIBS = $(LIBS) $(COM_ERR_LIB)

LIB=profile
LIBMAJOR=1
LIBMINOR=1
SHLIB_EXPDEPS = $(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS = $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS = -L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

diff -c -r src.old/util/pty/Makefile.in src/util/pty/Makefile.in
*** src.old/util/pty/Makefile.in Fri Apr 18 15:23:48 2003
--- src/util/pty/Makefile.in Fri Apr 18 15:23:29 2003
***************
*** 38,44 ****
SRCS=pty_err.c $(CFILES)
SHLIB_EXPDEPS = \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS= -lcom_err
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

--- 38,44 ----
SRCS=pty_err.c $(CFILES)
SHLIB_EXPDEPS = \
$(COM_ERR_DEPLIB)
! SHLIB_EXPLIBS= $(LIBS) $(COM_ERR_LIB)
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

***************
*** 54,60 ****
dump-utmp.o: dump-utmp.c

pty_paranoia: pty_paranoia.o $(COM_ERR_DEPLIB) $(PTY_DEPLIB)
! $(CC_LINK) -o pty_paranoia pty_paranoia.o $(PTY_LIB) $(COM_ERR_LIB) $(LIBS)

check-paranoia: pty_paranoia
$(KRB5_RUN_ENV) ./pty_paranoia
--- 54,60 ----
dump-utmp.o: dump-utmp.c

pty_paranoia: pty_paranoia.o $(COM_ERR_DEPLIB) $(PTY_DEPLIB)
! $(CC_LINK) -o pty_paranoia pty_paranoia.o $(PTY_LIB) $(LIBS) $(COM_ERR_LIB)

check-paranoia: pty_paranoia
$(KRB5_RUN_ENV) ./pty_paranoia
Subject: Kerberos programs link to installed dynamic libraries on Mac OS X
See "compiling krb5-1.2.8 for OS X Server 10.2.5" thread in krbdev.
Quick summary: He's been tripped up by the linker's search through the
library path for dynamic libraries before searching for static
libraries. Most other linkers don't actually work that way (they search
each directory for both shared and static libraries, then move on to the
next directory), except modern Tru64 and that difference is documented
along with the means to use the old style behavior, which I think we're
doing.

Mac OS X, on the other hand, does search all the directories for dynamic
libraries before looking for static libraries, it's not documented, and
there's no (known) way to change it. So building a static-only tree
when dynamic libraries are installed will not work properly.
This is really an OS/toolchain bug, which has since been fixed.