From 168384a1fcc6703f6c3caf6e16d3cb075ff6a30b Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Tue, 24 May 2022 11:10:29 -0500 Subject: [PATCH] EX-5045 lipe: use LDADD Use foo_LDADD rather than foo_LDFLAGS to avoid future errors with strict linkers. Remove AC_SEARCH_LIBS() uses for ext2fs and com_err, since we already use PKG_CHECK_MODULES() to check for ext2fs libraries, and not all lipe utilities need -lext2fs. Signed-off-by: John L. Hammond Change-Id: I1de960fcec5a8770984d9b1437423a854948eb84 Reviewed-on: https://review.whamcloud.com/47443 Tested-by: jenkins Reviewed-by: Feng, Lei Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Andreas Dilger --- lipe/configure.ac | 5 ----- lipe/src/Makefile.am | 46 +++++++++++++++++++++++++---------------- lipe/src/lipe_scan3/Makefile.am | 4 ++-- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/lipe/configure.ac b/lipe/configure.ac index 378c614..5841386 100644 --- a/lipe/configure.ac +++ b/lipe/configure.ac @@ -292,11 +292,6 @@ AS_IF([test "x$enable_zfs" = xyes ], [ LIBS=$saved_libs ]) -dnl Pull the needed libraries into LIBS (needed for the AC_LINK_IFELSE below) -dnl These should never fail if the PKG_CHECK above passes -AC_SEARCH_LIBS([com_err], [com_err]) -AC_SEARCH_LIBS([ext2fs_open2], [ext2fs]) - LIPE_RELEASE="1" AC_DEFINE_UNQUOTED(RELEASE, "$LIPE_RELEASE", [release info] ) AC_DEFINE_UNQUOTED(LIPE_RELEASE, "$LIPE_RELEASE", [release info] ) diff --git a/lipe/src/Makefile.am b/lipe/src/Makefile.am index 32cb759..2be68ed 100644 --- a/lipe/src/Makefile.am +++ b/lipe/src/Makefile.am @@ -1,9 +1,16 @@ AUTOMAKE_OPTIONS = -Wall foreign ACLOCAL_AMFLAGS = ${ALOCAL_FLAGS} +liblustre_LIBS = -llustreapi -llnetconfig $(json_c_LIBS) $(yaml_LIBS) -lm + +ssh_LIBS = -lssh + +if HAVE_SSH_THREADS +ssh_LIBS += -lssh_threads +endif + AM_CPPFLAGS = -D_GNU_SOURCE -include config.h -AM_CFLAGS = -g -Wall -Werror $(json_c_CFLAGS) -AM_LDFLAGS = -llustreapi -llnetconfig -lyaml -lm -lpthread $(json_c_LIBS) +AM_CFLAGS = -Wall -Werror -g bin_PROGRAMS = \ lpcc_purge @@ -40,9 +47,13 @@ LIPE_SOURCES = debug.c debug.h \ policy.c policy.h \ general_policy.h general_policy.c \ posix.c posix.h posix_ea.c posix_ea.h +LIPE_CFLAGS = $(json_c_CFLAGS) +LIPE_LDADD = $(liblustre_LIBS) -lpthread if BUILD_SERVER ext4_inode2path_SOURCES = debug.c debug.h ext4_inode2path.c +ext4_inode2path_CFLAGS = $(ext2fs_CFLAGS) +ext4_inode2path_LDADD = $(ext2fs_LIBS) LIPE_SOURCES += cmd.c \ cmd.h \ @@ -53,62 +64,61 @@ LIPE_SOURCES += cmd.c \ list.h \ lustre_ea_ldiskfs.c \ lustre_ea_ldiskfs.h +LIPE_CFLAGS += $(ext2fs_CFLAGS) +LIPE_LDADD += $(ext2fs_LIBS) endif -LIPE_CFLAGS = -Wall -Werror -g -I/usr/include $(json_c_CFLAGS) -LIPE_LDFLAGS = $(AM_LDFLAGS) - if ZFS LIPE_SOURCES += lipe_zfs.h lipe_zfs.c zfs_read_ldd.c zfs_read_ldd.h -LIPE_LDFLAGS += -lzfs -lzpool -lnvpair LIPE_CFLAGS += $(zfs_CFLAGS) +LIPE_LDADD += -lzfs -lzpool -lnvpair endif if BUILD_SERVER lipe_scan_SOURCES = lipe_scan.c lipe_config.c lipe_config.h lipe_result.c lipe_result.h $(LIPE_SOURCES) lipe_scan_CFLAGS = $(LIPE_CFLAGS) -lipe_scan_LDFLAGS = $(LIPE_LDFLAGS) -lssl -lcrypto -lyaml +lipe_scan_LDADD = $(LIPE_LDADD) -lssl -lcrypto $(yaml_LIBS) lipe_scan2_SOURCES = lipe_scan2.c lipe_scan2.h $(LIPE_SOURCES) lipe_scan2_CFLAGS = $(LIPE_CFLAGS) -lipe_scan2_LDFLAGS = $(LIPE_LDFLAGS) +lipe_scan2_LDADD = $(LIPE_LDADD) lfill_SOURCES = cmd.c cmd.h debug.c debug.h lfill.c ldiskfs_read_ldd.c \ ldiskfs_read_ldd.h misc.c misc.h +lfill_LDADD = $(LIPE_LDADD) ldumpstripe_SOURCES = ldumpstripe.c lustre_ea.h lustre_ea.c debug.c debug.h +ldumpstripe_LDADD = $(liblustre_LIBS) laudit_SOURCES = laudit.c +laudit_LDADD = $(json_c_LIBS) $(liblustre_LIBS) laudit_report_SOURCES = laudit-report.c +laudit_report_LDADD = $(json_c_LIBS) $(liblustre_LIBS) lipe_ssh_SOURCES = lipe_ssh.c lipe_ssh.h lamigo_SOURCES = lx_log.h lamigo.c lamigo.h lamigo_alr.c lamigo_hash.c lamigo_hash.h \ $(LIPE_SOURCES) $(lipe_ssh_SOURCES) lamigo_CFLAGS = $(LIPE_CFLAGS) -lamigo_LDFLAGS = $(LIPE_LDFLAGS) -lssh - -if HAVE_SSH_THREADS -lamigo_LDFLAGS += -lssh_threads -endif +lamigo_LDADD = $(LIPE_LDADD) $(json_c_LIBS) $(liblustre_LIBS) $(ssh_LIBS) lpurge_SOURCES = lx_log.h lpurge.c $(LIPE_SOURCES) lpurge_CFLAGS = $(LIPE_CFLAGS) -lpurge_LDFLAGS = $(LIPE_LDFLAGS) +lpurge_LDADD = $(LIPE_LDADD) lipe_expression_test_SOURCES = lipe_expression_test.c $(LIPE_SOURCES) lipe_expression_test_CFLAGS = $(LIPE_CFLAGS) -lipe_expression_test_LDFLAGS = $(LIPE_LDFLAGS) +lipe_expression_test_LDADD = $(LIPE_LDADD) endif generate_definition_SOURCES = generate_definition.c debug.c debug.h \ general_policy.h -generate_definition_CFLAGS = -Wall -Werror -Wall -Werror -g -generate_definition_LDFLAGS = +# generate_definition_CFLAGS = +# generate_definition_LDADD = lpcc_purge_SOURCES = lpcc_purge.c $(LIPE_SOURCES) lpcc_purge_CFLAGS = $(LIPE_CFLAGS) -lpcc_purge_LDFLAGS = $(LIPE_LDFLAGS) +lpcc_purge_LDADD = $(LIPE_LDADD) all: all-am diff --git a/lipe/src/lipe_scan3/Makefile.am b/lipe/src/lipe_scan3/Makefile.am index 55746e3..340e79e 100644 --- a/lipe/src/lipe_scan3/Makefile.am +++ b/lipe/src/lipe_scan3/Makefile.am @@ -11,8 +11,8 @@ bin_PROGRAMS = lipe_scan3 # Define LUSTRE_UTILS to prevent #error when including lustre_ioctl.h. lipe_scan3_CPPFLAGS = -D_GNU_SOURCE -DLUSTRE_UTILS $(GUILE_CFLAGS) -I .. -I ../.. -include config.h -lipe_scan3_CFLAGS = -Wall -Werror -g $(json_c_CFLAGS) $(GUILE_CFLAGS) -O -lipe_scan3_LDFLAGS = -pthread $(json_c_LIBS) -llnetconfig -llustreapi $(GUILE_LIBS) +lipe_scan3_CFLAGS = -Wall -Werror -g -O $(GUILE_CFLAGS) $(ext2fs_CFLAGS) $(json_c_CFLAGS) +lipe_scan3_LDADD = -llustreapi -llnetconfig $(GUILE_LIBS) $(ext2fs_LIBS) $(json_c_LIBS) -lpthread lipe_scan3_SOURCES = \ ../lipe_version.c \ -- 1.8.3.1