[PATCH 1/4] erofs-utils: fix build error without lz4 library

Gao Xiang hsiangkao at redhat.com
Fri Oct 30 23:30:17 AEDT 2020


This fixes a recent build error if lz4 library doesn't install,

/bin/sh ../libtool  --tag=CC   --mode=link gcc -Wall -Werror -I../include -g -O2   -o mkfs.erofs mkfs_erofs-main.o -luuid  ../lib/liberofs.la  -llz4
libtool: link: gcc -Wall -Werror -I../include -g -O2 -o mkfs.erofs mkfs_erofs-main.o  -luuid ../lib/.libs/liberofs.a -llz4
/usr/bin/ld: cannot find -llz4

Fixes: c497d89e5eac ("erofs-utils: enhance static linking for lz4 1.8.x")
Signed-off-by: Gao Xiang <hsiangkao at redhat.com>
---
 configure.ac     | 2 ++
 mkfs/Makefile.am | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 0f40a84..bff1e29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -240,7 +240,9 @@ if test "x${have_lz4}" = "xyes"; then
   else
     test -z "${with_lz4_libdir}" || LZ4_LIBS="-R${with_lz4_libdir} $LZ4_LIBS"
   fi
+  liblz4_LIBS="${LZ4_LIBS}"
 fi
+AC_SUBST([liblz4_LIBS])
 
 AC_CONFIG_FILES([Makefile
 		 man/Makefile
diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am
index ecc468c..8b8e051 100644
--- a/mkfs/Makefile.am
+++ b/mkfs/Makefile.am
@@ -6,5 +6,5 @@ bin_PROGRAMS     = mkfs.erofs
 AM_CPPFLAGS = ${libuuid_CFLAGS} ${libselinux_CFLAGS}
 mkfs_erofs_SOURCES = main.c
 mkfs_erofs_CFLAGS = -Wall -Werror -I$(top_srcdir)/include
-mkfs_erofs_LDADD = ${libuuid_LIBS} $(top_builddir)/lib/liberofs.la ${libselinux_LIBS} ${LZ4_LIBS}
+mkfs_erofs_LDADD = ${libuuid_LIBS} $(top_builddir)/lib/liberofs.la ${libselinux_LIBS} ${liblz4_LIBS}
 
-- 
2.18.1



More information about the Linux-erofs mailing list