[PATCH 1/2] AOSP: erofs-utils: avoid lzma inclusion when liblzma is disabled

Gao Xiang hsiangkao at linux.alibaba.com
Wed Nov 10 17:49:31 AEDT 2021


As Daeho reported [1], erofs-utils will fail to build with the
current AOSP Android.bp:

external/erofs-utils/lib/compressor_liblzma.c:8:10: fatal error:
'lzma.h' file not found
         ^~~~~~~~
1 error generated.
16:13:47 ninja failed with: exit status 1

compressor_liblzma.c won't be compiled if ENABLE_LIBLZMA is not
defined according to lib/Makefile.am. Thus it doesn't have an impact
on non-Android scenarios.

[1] https://lore.kernel.org/r/CACOAw_wt+DX0D+Ps-K=oF+MgUxtVKbXpamShoZR7n4WwM+wODw@mail.gmail.com
Reported-by: Daeho Jeong <daehojeong at google.com>
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/compressor_liblzma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/compressor_liblzma.c b/lib/compressor_liblzma.c
index e9bfcc556c54..40a05efb11dc 100644
--- a/lib/compressor_liblzma.c
+++ b/lib/compressor_liblzma.c
@@ -5,6 +5,8 @@
  * Copyright (C) 2021 Gao Xiang <xiang at kernel.org>
  */
 #include <stdlib.h>
+#include "config.h"
+#ifdef HAVE_LIBLZMA
 #include <lzma.h>
 #include "erofs/config.h"
 #include "erofs/print.h"
@@ -103,3 +105,4 @@ struct erofs_compressor erofs_compressor_lzma = {
 	.setlevel = erofs_compressor_liblzma_setlevel,
 	.compress_destsize = erofs_liblzma_compress_destsize,
 };
+#endif
-- 
2.24.4



More information about the Linux-erofs mailing list