Bug 29062

Summary: [libkrb] krb4 and krb5 multiply defined version symbol
Product: Base System Reporter: Greg <Greg>
Component: binAssignee: Mark Murray <markm>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description Greg 2001-07-18 17:20:01 UTC
When linking a program with both krb4 and krb5 libraries, and making a
static executable, the link fails with a multiply defined symbol.
The following krb5 and krb4 lines, in concert, provoked the failure.

LDADD+= -lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcom_err

LDADD+=	-lkrb -lcrypto -lcom_err

Each library defines symbols referring to version strings, and
includes then in a module that is almost certain to be included.

Fix: Both kerberosIV and kerberos5 define krb4 and heimdal version strings.
The following patch causes each library to define its own version, and
avoids trying to reference the krb4 version string in the krb5
library.
How-To-Repeat: 
Apply the following patch to src/gnu/usr.bin/cvs/cvs/Makefile and build

Index: gnu/usr.bin/cvs/cvs/Makefile
===================================================================
RCS file: /FREEBSD-CVS/src/gnu/usr.bin/cvs/cvs/Makefile,v
retrieving revision 1.32.2.1
diff -u -r1.32.2.1 Makefile
--- gnu/usr.bin/cvs/cvs/Makefile	2001/04/25 12:03:33	1.32.2.1
+++ gnu/usr.bin/cvs/cvs/Makefile	2001/07/18 16:15:37
@@ -28,6 +28,21 @@
 DPADD+=	${LIBCVS} ${LIBDIFF} ${LIBGNUREGEX} ${LIBMD} ${LIBCRYPT} ${LIBZ}
 LDADD+=	${LIBCVS} ${LIBDIFF} -lgnuregex -lmd -lcrypt -lz
 
+# KLUDGE!  gssapi/krb5 is first because the resolv.o in libroken
+# appears to be a superset of the resolv.o in libkrb, and this
+# order avoids the libkrb version being added, and thus avoids
+# multiply defined symbol errors for the symbols that are defined.
+.if exists(${DESTDIR}${LIBDIR}/libgssapi.a) && defined(MAKE_KERBEROS5)
+CFLAGS+=-DHAVE_GSSAPI -DHAVE_GSSAPI_H -DHAVE_GSS_C_NT_HOSTBASED_SERVICE
+# The LDADD line below is for the heimdal implementation of gssapi/krb5
+LDADD+= -lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcom_err
+# XXX DPADD should have gssapi, krb5, adn1, roken but not in libnames.mk
+DPADD+= ${LIBCRYPTO} ${LIBCOM_ERR}
+DISTRIBUTION=	krb5
+# definitely want encryption
+CFLAGS+= -DENCRYPTION
+.endif
+
 .if exists(${DESTDIR}${LIBDIR}/libkrb.a) && defined(MAKE_KERBEROS4)
 CFLAGS+=-DHAVE_KERBEROS -DHAVE_KRB_GET_ERR_TEXT
 LDADD+=	-lkrb -lcrypto -lcom_err
Comment 1 Kris Kennaway freebsd_committer freebsd_triage 2001-07-26 03:35:26 UTC
Responsible Changed
From-To: freebsd-bugs->markm

Over to maintainer
Comment 2 Mark Murray freebsd_committer freebsd_triage 2012-03-05 11:11:44 UTC
State Changed
From-To: open->closed

KerberosIV no longer used.