[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

library dependancies



Hello,

(quick summary: in order to fix dependencies for most libraries in
Heimdal, please apply attached patch; this should work even for
libtool < 1.4, although it is most useful for libtool 1.4;
please see bottom for list of known bugs).


in order to properly support libtool 1.4, I want to find out *exactly*
what libraries depend on other libraries.

Indirect dependencies do not count. So, if libgssapi doesn't use
libcom_err, for instance, it doesn't depend on it, even if libkrb5
does. Instead libcom_err would only depend on libkrb5, and libcom_err
would get pulled in automatically.

Dependencies are important, or otherwise things could break if I split
the libraries about in the Debian package (required to enable
backwards compatibility).

Or, put another way, if all libraries are without any existing
dependencies (ie broken):

>ldd /usr/lib/libkrb5.so            
libc.so.6 => /lib/libc.so.6 (0x4003a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)

you should be able to type in a command with the minimal set of dependent
libraries:

gcc -o /dev/null -lkrb5 -lroken -lasn1 -lcom_err -lcrypto -ldb -lresolv

and not get any undefined symbol errors generated from libkrb5 (from
other libraries are OK, that just means that library requires fixing,
too).

So I used:

gcc -o /dev/null -lkrb5 -lroken -lasn1 -lcom_err -lcrypto -ldb -lresolv 2>&1 | grep krb5

So, here is a summary of what the dependencies are.  Please tell me if
I have got anything that looks wrong.

(I am taking a few shortcuts here, and not including the leading lib
prefix; also I am assuming that openssl is used, when modifying the
Makefiles, proper care needs to be taken to ensure correct library is
used)


com_err:   <nothing>
roken:     -lcrypto -ldb  -lresolv
sl:        -lroken  -lreadline
asn1:      -lcom_err
krb5:      -lroken -lasn1 -lcom_err -lcrypto -ldb -lresolv 
hdb:       -lroken -lkrb5 -lcom_err -lasn1 -ldb 
kadm5srv:  -lroken -lkrb5 -lcom_err -lhdb  -ldl
kadm5clnt: -lroken -lkrb5 -lcom_err 
gssapi:    -lkrb5  -lcrypto -lasn1
otp:       -lroken -lcrypto -ldb

not checked (as this aren't used for my Debian package, please can
somebody tell me what these depend on?):

dce
45
kafs
kdfs
auth
des
editline

Same thing goes with the applications, although I wont worry too much
about them just yet

(libvers not included as it is a convenience library)


So far, libkrb5 looks OK, but I think it is the only one. 

I have attached a patch to fix most of these problems. It is not
perfect yet, but a good start.

I haven't yet looked at removing redundant dependencies in the
programs though, this will be a bigger task that isn't so important
yet.

PROBLEMS ENCOUNTERED:

1. where is this function defined?

[555] [snoopy:unstable:bam] ~/source/ext2fs/heimdal-0.3e/build-tree/heimdal-0.3e/lib >gcc -o/dev/null sl/.libs/libss.so                  
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x18): undefined reference to `main'
sl/.libs/libss.so: undefined reference to `com_err_va'
collect2: ld returned 1 exit status

2. the demo Makefile.am with libtool 1.4 has:
libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*"
The -no-undefined option doesn't seem to do anything though.
(it doesn't complain when linking libssl.). So I didn't include it
in this patch.

3. I have checked all generating files with objdump, and they look OK
according to the table above, however, I have note properly tested it
yet (ie. I haven't run any executables; will do that tomorrow).

When/if I get these fixed, I will send an updated patch.

For now though here is the patch:

diff -ruN heimdal-0.3e-old/cf/Makefile.am.common heimdal-0.3e/cf/Makefile.am.common
--- heimdal-0.3e-old/cf/Makefile.am.common	Tue Dec  5 20:11:09 2000
+++ heimdal-0.3e/cf/Makefile.am.common	Sat May 12 17:00:04 2001
@@ -171,8 +171,7 @@
 endif
 
 if KRB5
-LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
-	$(top_builddir)/lib/asn1/libasn1.la
+LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la
 LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
 endif
 
diff -ruN heimdal-0.3e-old/cf/roken-frag.m4 heimdal-0.3e/cf/roken-frag.m4
--- heimdal-0.3e-old/cf/roken-frag.m4	Sat Dec 16 01:29:54 2000
+++ heimdal-0.3e/cf/roken-frag.m4	Sat May 12 17:22:41 2001
@@ -578,9 +578,9 @@
 dnl moved to AC_OUTPUT in configure.in
 dnl AC_CONFIG_FILES($1/Makefile)
 
-LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
+dnl LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
 
 AC_SUBST(DIR_roken)dnl
 AC_SUBST(LIB_roken)dnl
 AC_SUBST(INCLUDES_roken)dnl
-])
\ No newline at end of file
+])
diff -ruN heimdal-0.3e-old/cf/roken.m4 heimdal-0.3e/cf/roken.m4
--- heimdal-0.3e-old/cf/roken.m4	Sun Jul  9 01:50:34 2000
+++ heimdal-0.3e/cf/roken.m4	Sat May 12 16:30:55 2001
@@ -56,7 +56,7 @@
   CPPFLAGS_roken="-I$i/include"
 fi
 
-LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
+dnl LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
 
 AC_SUBST(LIB_roken)dnl
 AC_SUBST(DIR_roken)dnl
diff -ruN heimdal-0.3e-old/lib/asn1/Makefile.am heimdal-0.3e/lib/asn1/Makefile.am
--- heimdal-0.3e-old/lib/asn1/Makefile.am	Tue Jan 30 12:46:53 2001
+++ heimdal-0.3e/lib/asn1/Makefile.am	Sat May 12 17:07:06 2001
@@ -6,6 +6,8 @@
 
 lib_LTLIBRARIES = libasn1.la
 libasn1_la_LDFLAGS = -version-info 4:0:2
+libasn1_la_LIBADD = \
+	$(top_builddir)/lib/com_err/libcom_err.la
 
 BUILT_SOURCES =			\
 	$(gen_files:.x=.c)	\
diff -ruN heimdal-0.3e-old/lib/gssapi/Makefile.am heimdal-0.3e/lib/gssapi/Makefile.am
--- heimdal-0.3e-old/lib/gssapi/Makefile.am	Tue Jan 30 12:51:53 2001
+++ heimdal-0.3e/lib/gssapi/Makefile.am	Sat May 12 16:45:28 2001
@@ -6,6 +6,10 @@
 
 lib_LTLIBRARIES = libgssapi.la
 libgssapi_la_LDFLAGS = -version-info 3:0:2
+libgssapi_la_LIBADD = \
+	$(LIB_krb5) \
+	$(LIB_des) \
+	$(top_builddir)/lib/asn1/libasn1.la 
 
 include_HEADERS = gssapi.h
 
diff -ruN heimdal-0.3e-old/lib/hdb/Makefile.am heimdal-0.3e/lib/hdb/Makefile.am
--- heimdal-0.3e-old/lib/hdb/Makefile.am	Tue Jan 30 12:49:16 2001
+++ heimdal-0.3e/lib/hdb/Makefile.am	Sat May 12 18:17:48 2001
@@ -12,17 +12,18 @@
 CLEANFILES = $(BUILT_SOURCES) $(foo) hdb_asn1.h asn1_files
 
 noinst_PROGRAMS = convert_db
-LDADD = libhdb.la \
+LDADD = libhdb.la
+
+lib_LTLIBRARIES = libhdb.la
+libhdb_la_LDFLAGS = -version-info 7:0:0
+libhdb_la_LIBADD = \
 	$(LIB_openldap) \
 	../krb5/libkrb5.la \
 	../asn1/libasn1.la \
-	$(LIB_des) \
 	$(LIB_roken) \
+	$(top_builddir)/lib/com_err/libcom_err.la \
 	$(DBLIB)
 
-lib_LTLIBRARIES = libhdb.la
-libhdb_la_LDFLAGS = -version-info 7:0:0
-
 libhdb_la_SOURCES =				\
 	common.c				\
 	db.c					\
@@ -38,8 +39,6 @@
 INCLUDES += $(INCLUDE_openldap)
 
 include_HEADERS = hdb.h hdb_err.h hdb_asn1.h hdb-protos.h hdb-private.h
-
-libhdb_la_LIBADD = $(LIB_openldap)
 
 $(libhdb_la_OBJECTS): $(srcdir)/hdb-protos.h $(srcdir)/hdb-private.h
 
diff -ruN heimdal-0.3e-old/lib/kadm5/Makefile.am heimdal-0.3e/lib/kadm5/Makefile.am
--- heimdal-0.3e-old/lib/kadm5/Makefile.am	Tue Jan 30 12:56:00 2001
+++ heimdal-0.3e/lib/kadm5/Makefile.am	Sat May 12 18:18:46 2001
@@ -4,7 +4,20 @@
 
 lib_LTLIBRARIES = libkadm5srv.la libkadm5clnt.la
 libkadm5srv_la_LDFLAGS = -version-info 7:3:0
+libkadm5srv_la_LIBADD = \
+	$(LIB_roken) \
+	$(LIB_krb5) \
+	$(top_builddir)/lib/com_err/libcom_err.la \
+	$(top_builddir)/lib/asn1/libasn1.la \
+	$(top_builddir)/lib/hdb/libhdb.la \
+	$(LIB_dlopen)
+
 libkadm5clnt_la_LDFLAGS = -version-info 6:1:2
+libkadm5clnt_la_LIBADD = \
+	$(LIB_roken) \
+	$(LIB_krb5) \
+	$(top_builddir)/lib/com_err/libcom_err.la
+
 sbin_PROGRAMS = dump_log replay_log truncate_log
 
 libexec_PROGRAMS = ipropd-master ipropd-slave
diff -ruN heimdal-0.3e-old/lib/krb5/Makefile.am heimdal-0.3e/lib/krb5/Makefile.am
--- heimdal-0.3e-old/lib/krb5/Makefile.am	Tue Jan 30 12:50:52 2001
+++ heimdal-0.3e/lib/krb5/Makefile.am	Sat May 12 17:07:29 2001
@@ -9,16 +9,15 @@
 check_PROGRAMS = n-fold-test string-to-key-test
 TESTS = n-fold-test string-to-key-test
 
-LDADD = libkrb5.la \
-	$(LIB_des) \
-	$(top_builddir)/lib/asn1/libasn1.la \
-	$(LIB_roken)
+LDADD = libkrb5.la
 
 libkrb5_la_LIBADD = \
-	../com_err/error.lo ../com_err/com_err.lo \
+	$(LIB_res_search) \
+	$(top_builddir)/lib/com_err/libcom_err.la \
 	$(LIB_des) \
 	$(top_builddir)/lib/asn1/libasn1.la \
-	$(LIB_roken)
+	$(LIB_roken) \
+	$(LIB_dbopen)
 
 lib_LTLIBRARIES = libkrb5.la
 
diff -ruN heimdal-0.3e-old/lib/otp/Makefile.am heimdal-0.3e/lib/otp/Makefile.am
--- heimdal-0.3e-old/lib/otp/Makefile.am	Tue Jan 30 12:54:48 2001
+++ heimdal-0.3e/lib/otp/Makefile.am	Sat May 12 17:08:03 2001
@@ -6,15 +6,16 @@
 
 noinst_PROGRAMS = otptest
 
-otptest_LDADD = libotp.la \
-	$(LIB_des) \
-	$(LIB_roken) \
-	$(DBLIB)
+otptest_LDADD = libotp.la
 
 include_HEADERS = otp.h
 
 lib_LTLIBRARIES = libotp.la
 libotp_la_LDFLAGS = -version-info 1:2:1
+libotp_la_LIBADD = \
+	$(LIB_roken) \
+	$(LIB_des) \
+	$(DBLIB)
 
 libotp_la_SOURCES = \
 	otp.c \
diff -ruN heimdal-0.3e-old/lib/roken/Makefile.am heimdal-0.3e/lib/roken/Makefile.am
--- heimdal-0.3e-old/lib/roken/Makefile.am	Tue Jan 30 12:53:30 2001
+++ heimdal-0.3e/lib/roken/Makefile.am	Sat May 12 17:30:56 2001
@@ -11,6 +11,11 @@
 
 lib_LTLIBRARIES = libroken.la
 libroken_la_LDFLAGS = -version-info 11:1:2
+libroken_la_LIBADD = \
+	@LIB_res_search@ \
+	$(LIB_des) \
+	@LIB_dbopen@ \
+	@LTLIBOBJS@
 
 noinst_PROGRAMS = make-roken
 
@@ -149,8 +154,6 @@
 	writev.c
 
 EXTRA_DIST = roken.awk roken.h.in
-
-libroken_la_LIBADD = @LTLIBOBJS@
 
 $(LTLIBOBJS) $(libroken_la_OBJECTS): $(include_HEADERS) roken.h
 
diff -ruN heimdal-0.3e-old/lib/sl/Makefile.am heimdal-0.3e/lib/sl/Makefile.am
--- heimdal-0.3e-old/lib/sl/Makefile.am	Sat Jan 27 02:00:09 2001
+++ heimdal-0.3e/lib/sl/Makefile.am	Sat May 12 16:28:35 2001
@@ -10,8 +10,8 @@
 libsl_la_LDFLAGS = -version-info 1:1:1
 libss_la_LDFLAGS = -version-info 1:3:1
 
-libsl_la_LIBADD = @LIB_readline@
-libss_la_LIBADD = @LIB_readline@
+libsl_la_LIBADD = $(LIB_roken) @LIB_readline@
+libss_la_LIBADD = $(LIB_roken) @LIB_readline@
 
 RENAME_SRC = roken_rename.h strtok_r.c snprintf.c
 
diff -ruN heimdal-0.3e-old/tools/krb5-config.in heimdal-0.3e/tools/krb5-config.in
--- heimdal-0.3e-old/tools/krb5-config.in	Mon Jan 29 17:56:51 2001
+++ heimdal-0.3e/tools/krb5-config.in	Sat May 12 17:01:01 2001
@@ -89,6 +89,9 @@
 if test "$do_libs" = "yes"; then
     lib_flags="-L${libdir}"
     case $library in
+    krb5)
+	lib_flags="$lib_flags -lkrb5"
+	;;
     gssapi)
 	lib_flags="$lib_flags -lgssapi"
 	;;
@@ -99,8 +102,8 @@
 	lib_flags="$lib_flags -lkadm5srv"
 	;;
     esac
-    lib_flags="$lib_flags -lkrb5 -lasn1 @LIB_des_appl@ -lroken"
-    lib_flags="$lib_flags @LIB_crypt@ @LIB_dbopen@ @LIBS@"
+#    lib_flags="$lib_flags -lkrb5 -lasn1 @LIB_des_appl@ -lroken"
+#    lib_flags="$lib_flags @LIB_crypt@ @LIB_dbopen@ @LIBS@"
     echo $lib_flags
 fi
 if test "$do_cflags" = "yes"; then
-- 
Brian May <bam@snoopy.apana.org.au>