[SSSD] [PATCH] Fix compilation with disabled link_all_deplibs.

Lukas Slebodnik lslebodn at redhat.com
Wed May 29 13:54:03 UTC 2013


On (21/05/13 17:32), Jakub Hrozek wrote:
>On Tue, May 21, 2013 at 05:17:14PM +0200, Lukas Slebodnik wrote:
>> ehlo,
>> 
>> This patch changes dependencies among libsss_util and libsss_child,
>> libsss_crypt, libsss_debug. Library libsss_util no longer depends on
>> any internal library. Each program, which was linked with libsss_util,
>> now directly link necessary libraries
>> (libsss_child, libsss_crypt, libsss_debug)
>> 
>> https://fedorahosted.org/sssd/ticket/1928
>> 
>> Patch attached.
>> Adding Timo to CC
>> 
>> LS
>
>It might improve readability to create a variable that would expand to
>libsss_util.la, libsss_child.la and libsss_debug.la. Then the following:
>
>> @@ -622,7 +619,10 @@ sssd_LDADD = \
>>      $(SSSD_LIBS) \
>>      $(LIBNL_LIBS) \
>>      $(KEYUTILS_LIBS) \
>> -    libsss_util.la
>> +    libsss_util.la \
>> +    libsss_crypt.la \
>> +    libsss_child.la \
>> +    libsss_debug.la
>>  
>
>Would become:
>
>      $(SSSD_LIBS) \
>      $(LIBNL_LIBS) \
>      $(KEYUTILS_LIBS) \
> -    libsss_util.la
> +    (SSSD_PRIVATE_LIBS)

I only replaced libsss_util.la with variable SSSD_INTERNAL_LTLIBS.
libsss_util.la is not required everywhere, therefore it was removed or replaced
with other internal library (for example libsss_debug.la)

New patch attached.

LS
-------------- next part --------------
>From e1195a26c432f901145eb45d0ebbb3b44b196f2e Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 21 May 2013 16:41:31 +0200
Subject: [PATCH] Fix compilation with disabled link_all_deplibs.

>From the Debian patch:
># Do not link against deplibs.  This is not needed for shared libs
># on at least ELF systems since those already know which libs they
># need themself.  This seems to break a few things and will be fixed
># in a better way in a future upstream version.

Overlinking has several issues. An obvious one is performance on startup,
a more serious is if one of the lib deps changes soname of something it links
against, and you could load two versions to the memory at the same time..

This patch changes dependencies among libsss_util and libsss_child,
libsss_crypt, libsss_debug. Library libsss_util no longer depends on
any internal library. Each program, which was linked with libsss_util,
now directly link necessary libraries
(libsss_child, libsss_crypt, libsss_debug)

https://fedorahosted.org/sssd/ticket/1928
---
 Makefile.am | 137 ++++++++++++++++++++++++++++--------------------------------
 1 file changed, 65 insertions(+), 72 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 250f9b674544567eca1d14e4fc7c73c3747bc2fc..c15c1f93c6eb2364b3959016e7141429158b3d63 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -565,10 +565,7 @@ libsss_util_la_SOURCES = \
     src/util/io.c
 libsss_util_la_LIBADD = \
     $(SSSD_LIBS) \
-    $(UNICODE_LIBS) \
-    libsss_child.la \
-    libsss_crypt.la \
-    libsss_debug.la
+    $(UNICODE_LIBS)
 if BUILD_SUDO
     libsss_util_la_SOURCES += src/db/sysdb_sudo.c
 endif
@@ -579,6 +576,12 @@ libsss_util_la_SOURCES += \
 endif
 libsss_util_la_LDFLAGS = -avoid-version
 
+SSSD_INTERNAL_LTLIBS = \
+    libsss_crypt.la \
+    libsss_debug.la \
+    libsss_child.la \
+    libsss_util.la
+
 lib_LTLIBRARIES = libipa_hbac.la libsss_idmap.la libsss_nss_idmap.la
 dist_pkgconfig_DATA += src/providers/ipa/ipa_hbac.pc
 libipa_hbac_la_SOURCES = \
@@ -622,7 +625,7 @@ sssd_LDADD = \
     $(SSSD_LIBS) \
     $(LIBNL_LIBS) \
     $(KEYUTILS_LIBS) \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 
 sssd_nss_SOURCES = \
     src/responder/nss/nsssrv.c \
@@ -635,7 +638,7 @@ sssd_nss_LDADD = \
     $(TDB_LIBS) \
     $(SSSD_LIBS) \
     libsss_idmap.la \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 
 sssd_pam_SOURCES = \
     src/responder/pam/pam_LOCAL_domain.c \
@@ -648,7 +651,7 @@ sssd_pam_LDADD = \
     $(TDB_LIBS) \
     $(SSSD_LIBS) \
     $(SELINUX_LIBS) \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 
 if BUILD_SUDO
 sssd_sudo_SOURCES = \
@@ -660,7 +663,7 @@ sssd_sudo_SOURCES = \
     $(SSSD_RESPONDER_OBJ)
 sssd_sudo_LDADD = \
     $(SSSD_LIBS) \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 endif
 
 if BUILD_AUTOFS
@@ -671,7 +674,7 @@ sssd_autofs_SOURCES = \
     $(SSSD_RESPONDER_OBJ)
 sssd_autofs_LDADD = \
     $(SSSD_LIBS) \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 endif
 
 if BUILD_SSH
@@ -682,7 +685,7 @@ sssd_ssh_SOURCES = \
     $(SSSD_RESPONDER_OBJ)
 sssd_ssh_LDADD = \
     $(SSSD_LIBS) \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 endif
 
 sssd_pac_SOURCES = \
@@ -699,7 +702,7 @@ sssd_pac_LDADD = \
     $(TDB_LIBS) \
     $(SSSD_LIBS) \
     libsss_idmap.la \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 
 sssd_be_SOURCES = \
     src/providers/data_provider_be.c \
@@ -712,7 +715,7 @@ sssd_be_LDADD = \
     -ldl \
     $(SSSD_LIBS) \
     $(CARES_LIBS) \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 sssd_be_LDFLAGS = \
     -Wl,--version-script,$(srcdir)/src/providers/sssd_be.exports \
     -export-dynamic \
@@ -743,16 +746,16 @@ sss_useradd_SOURCES = \
     src/tools/sss_useradd.c \
     $(SSSD_TOOLS_OBJ)
 sss_useradd_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 
 sss_userdel_SOURCES = \
     src/tools/sss_userdel.c \
     src/util/find_uid.c \
     $(SSSD_LCL_TOOLS_OBJ)
 sss_userdel_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 sss_userdel_CFLAGS = $(AM_CFLAGS)
 sss_userdel_LDFLAGS = \
     $(CLIENT_LIBS)
@@ -761,15 +764,15 @@ sss_groupadd_SOURCES = \
     src/tools/sss_groupadd.c \
     $(SSSD_TOOLS_OBJ)
 sss_groupadd_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 
 sss_groupdel_SOURCES = \
     src/tools/sss_groupdel.c \
     $(SSSD_LCL_TOOLS_OBJ)
 sss_groupdel_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 sss_groupdel_CFLAGS = $(AM_CFLAGS)
 sss_groupdel_LDFLAGS = \
     $(CLIENT_LIBS)
@@ -778,8 +781,8 @@ sss_usermod_SOURCES = \
     src/tools/sss_usermod.c \
     $(SSSD_LCL_TOOLS_OBJ)
 sss_usermod_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 sss_usermod_CFLAGS = $(AM_CFLAGS)
 sss_usermod_LDFLAGS = \
     $(CLIENT_LIBS)
@@ -788,8 +791,8 @@ sss_groupmod_SOURCES = \
     src/tools/sss_groupmod.c \
     $(SSSD_LCL_TOOLS_OBJ)
 sss_groupmod_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 sss_groupmod_CFLAGS = $(AM_CFLAGS)
 sss_groupmod_LDFLAGS = \
     $(CLIENT_LIBS)
@@ -798,15 +801,15 @@ sss_groupshow_SOURCES = \
     src/tools/sss_groupshow.c \
     $(SSSD_TOOLS_OBJ)
 sss_groupshow_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 
 sss_cache_SOURCES = \
     src/tools/sss_cache.c \
     $(SSSD_LCL_TOOLS_OBJ)
 sss_cache_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 sss_cache_CFLAGS = $(AM_CFLAGS)
 sss_cache_LDFLAGS = \
     $(CLIENT_LIBS)
@@ -815,15 +818,15 @@ sss_debuglevel_SOURCES = \
     src/tools/sss_debuglevel.c \
     $(SSSD_TOOLS_OBJ)
 sss_debuglevel_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 
 sss_seed_SOURCES = \
     src/tools/sss_seed.c \
     $(SSSD_TOOLS_OBJ)
 sss_seed_LDADD = \
-    libsss_util.la \
-    $(TOOLS_LIBS)
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS)
 
 if BUILD_SUDO
 sss_sudo_cli_SOURCES = \
@@ -842,8 +845,8 @@ sss_ssh_authorizedkeys_SOURCES = \
     src/sss_client/ssh/sss_ssh_authorizedkeys.c
 sss_ssh_authorizedkeys_CFLAGS = $(AM_CFLAGS)
 sss_ssh_authorizedkeys_LDADD = \
-    libsss_util.la
-sss_ssh_authorizedkeys_LDFLAGS = $(CLIENT_LIBS)
+    $(SSSD_INTERNAL_LTLIBS)
+sss_ssh_authorizedkeys_LDFLAGS = $(CLIENT_LIBS) $(TALLOC_LIBS) $(POPT_LIBS)
 
 sss_ssh_knownhostsproxy_SOURCES = \
     src/sss_client/common.c \
@@ -851,8 +854,8 @@ sss_ssh_knownhostsproxy_SOURCES = \
     src/sss_client/ssh/sss_ssh_knownhostsproxy.c
 sss_ssh_knownhostsproxy_CFLAGS = $(AM_CFLAGS)
 sss_ssh_knownhostsproxy_LDADD = \
-    libsss_util.la
-sss_ssh_knownhostsproxy_LDFLAGS = $(CLIENT_LIBS)
+    $(SSSD_INTERNAL_LTLIBS)
+sss_ssh_knownhostsproxy_LDFLAGS = $(CLIENT_LIBS) $(TALLOC_LIBS) $(POPT_LIBS)
 endif
 
 #################
@@ -887,7 +890,7 @@ sysdb_tests_CFLAGS = \
 sysdb_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 sysdb_ssh_tests_DEPENDENCIES = \
@@ -900,7 +903,7 @@ sysdb_ssh_tests_CFLAGS = \
 sysdb_ssh_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 strtonum_tests_SOURCES = \
@@ -933,7 +936,7 @@ krb5_utils_tests_LDADD = \
     $(CARES_LIBS) \
     $(KRB5_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 
@@ -970,10 +973,9 @@ files_tests_CFLAGS = \
     $(AM_CFLAGS) \
     $(CHECK_CFLAGS)
 files_tests_LDADD = \
-    libsss_debug.la \
     $(FILES_TESTS_LIBS) \
     libsss_test_common.la \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 
 SSSD_RESOLV_TESTS_OBJ = \
     $(SSSD_RESOLV_OBJ)
@@ -994,7 +996,7 @@ resolv_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
     $(CARES_LIBS) \
-    libsss_util.la \
+    libsss_debug.la \
     libsss_test_common.la
 
 refcount_tests_SOURCES = \
@@ -1005,7 +1007,7 @@ refcount_tests_CFLAGS = \
 refcount_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 fail_over_tests_SOURCES = \
@@ -1018,7 +1020,7 @@ fail_over_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
     $(CARES_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 find_uid_tests_SOURCES = \
@@ -1046,7 +1048,7 @@ auth_tests_CFLAGS = \
 auth_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 ipa_ldap_opt_tests_SOURCES = \
@@ -1088,7 +1090,7 @@ simple_access_tests_LDADD = \
     $(CARES_LIBS) \
     $(CHECK_LIBS) \
     $(PAM_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 util_tests_SOURCES = \
@@ -1099,7 +1101,7 @@ util_tests_CFLAGS = \
 util_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 debug_tests_SOURCES = \
@@ -1111,7 +1113,7 @@ debug_tests_CFLAGS = \
 debug_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la
+    libsss_debug.la
 
 crypto_tests_SOURCES = \
     $(SSS_CRYPT_SOURCES) \
@@ -1135,7 +1137,6 @@ ipa_hbac_tests_CFLAGS = \
 ipa_hbac_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la \
     libsss_test_common.la \
     libipa_hbac.la
 
@@ -1164,8 +1165,7 @@ pac_responder_tests_LDADD = \
     $(SSSD_LIBS) \
     -lm \
     libsss_idmap.la \
-    libsss_debug.la \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 responder_socket_access_tests_SOURCES = \
@@ -1178,16 +1178,15 @@ responder_socket_access_tests_CFLAGS = \
     $(CHECK_CFLAGS)
 responder_socket_access_tests_LDADD = \
     $(CHECK_LIBS) \
-    $(TALLOC_LIBS) \
-    libsss_test_common.la \
-    libsss_util.la
+    $(SSSD_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS) \
+    libsss_test_common.la
 endif
 
 stress_tests_SOURCES = \
     src/tests/stress-tests.c
 stress_tests_LDADD = \
     $(SSSD_LIBS) \
-    libsss_util.la \
     libsss_test_common.la
 
 krb5_child_test_SOURCES = \
@@ -1207,11 +1206,11 @@ krb5_child_test_CFLAGS = \
     -DKRB5_CHILD_DIR=\"$(builddir)\" \
     $(CHECK_CFLAGS)
 krb5_child_test_LDADD = \
-    $(SSSD_LIBS)\
+    $(SSSD_LIBS) \
     $(CARES_LIBS) \
     $(KRB5_LIBS) \
     $(CHECK_LIBS) \
-    libsss_util.la \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
 if HAVE_CMOCKA
@@ -1242,9 +1241,10 @@ nss_srv_tests_LDFLAGS = \
     -Wl,-wrap,sss_cmd_done
 nss_srv_tests_LDADD = \
     $(CMOCKA_LIBS) \
+    $(SSSD_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la \
-    libsss_idmap.la \
-    libsss_util.la
+    libsss_idmap.la
 
 test_find_uid_DEPENDENCIES = \
     $(ldblib_LTLIBRARIES)
@@ -1258,11 +1258,10 @@ test_find_uid_CFLAGS = \
     $(TALLOC_CFLAGS) \
     $(DHASH_CFLAGS)
 test_find_uid_LDADD = \
-    libsss_debug.la \
     $(TALLOC_LIBS) \
     $(DHASH_LIBS) \
     $(CMOCKA_LIBS) \
-    libsss_util.la
+    libsss_debug.la
 
 test_io_SOURCES = \
     src/tests/cmocka/test_io.c \
@@ -1297,8 +1296,9 @@ dyndns_tests_LDFLAGS = \
 dyndns_tests_LDADD = \
     $(CARES_LIBS) \
     $(CMOCKA_LIBS) \
+    $(SSSD_LIBS) \
     libsss_test_common.la \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 endif
 
 noinst_PROGRAMS = pam_test_client
@@ -1492,7 +1492,6 @@ libsss_ldap_la_LIBADD = \
     $(OPENLDAP_LIBS) \
     $(DHASH_LIBS) \
     $(KRB5_LIBS) \
-    libsss_util.la \
     libsss_ldap_common.la \
     libsss_idmap.la
 libsss_ldap_la_LDFLAGS = \
@@ -1509,7 +1508,6 @@ libsss_proxy_la_SOURCES = \
 libsss_proxy_la_CFLAGS = \
     $(AM_CFLAGS)
 libsss_proxy_la_LIBADD = \
-    libsss_util.la \
     $(PAM_LIBS)
 libsss_proxy_la_LDFLAGS = \
     -avoid-version \
@@ -1521,8 +1519,7 @@ libsss_simple_la_SOURCES = \
 libsss_simple_la_CFLAGS = \
     $(AM_CFLAGS)
 libsss_simple_la_LIBADD = \
-    $(PAM_LIBS) \
-    libsss_util.la
+    $(PAM_LIBS)
 libsss_simple_la_LDFLAGS = \
     -avoid-version \
     -module
@@ -1538,7 +1535,6 @@ libsss_krb5_la_LIBADD = \
     $(DHASH_LIBS) \
     $(KEYUTILS_LIBS) \
     $(KRB5_LIBS) \
-    libsss_util.la \
     libsss_krb5_common.la
 libsss_krb5_la_LDFLAGS = \
     -avoid-version \
@@ -1583,7 +1579,6 @@ libsss_ipa_la_LIBADD = \
     $(DHASH_LIBS) \
     $(KEYUTILS_LIBS) \
     $(KRB5_LIBS) \
-    libsss_util.la \
     libsss_ldap_common.la \
     libsss_krb5_common.la \
     libipa_hbac.la \
@@ -1636,7 +1631,6 @@ libsss_ad_la_LIBADD = \
     $(KEYUTILS_LIBS) \
     $(KRB5_LIBS) \
     $(NDR_NBT_LIBS) \
-    libsss_util.la \
     libsss_ldap_common.la \
     libsss_krb5_common.la \
     libsss_idmap.la
@@ -1698,7 +1692,7 @@ proxy_child_CFLAGS = \
 proxy_child_LDADD = \
     $(PAM_LIBS) \
     $(SSSD_LIBS) \
-    libsss_util.la
+    $(SSSD_INTERNAL_LTLIBS)
 
 memberof_la_SOURCES = \
     src/ldb_modules/memberof.c \
@@ -1748,8 +1742,7 @@ pysss_la_CFLAGS = \
     $(PYTHON_CFLAGS)
 pysss_la_LIBADD = \
     $(PYTHON_BINDINGS_LIBS) \
-    $(PYTHON_LIBS) \
-    libsss_util.la
+    $(PYTHON_LIBS)
 pysss_la_LDFLAGS = \
     -avoid-version \
     -module
-- 
1.8.1.4



More information about the sssd-devel mailing list