[PATCH] erofs-utils: dump: fix linking when using --with-selinux
Gao Xiang
xiang at kernel.org
Sun Oct 3 15:41:14 AEDT 2021
Hi David,
On Sat, Oct 02, 2021 at 06:38:57PM -0400, David Michael wrote:
> The libselinux functions selabel_open and selabel_close are called
> by lib/config.c, so include libselinux in CFLAGS and LIBS to fix
> building dump.erofs.
>
> Signed-off-by: David Michael <fedora.dm0 at gmail.com>
> ---
>
> Hi,
>
> I tried building the dev branch with SELinux support and got this:
>
> /bin/sh ../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -Wall -Werror -I../include -O2 -pipe -Wl,-O1 -Wl,--as-needed -o dump.erofs dump_erofs-main.o ../lib/liberofs.la -luuid
> libtool: link: x86_64-pc-linux-gnu-gcc -Wall -Werror -I../include -O2 -pipe -Wl,-O1 -o dump.erofs dump_erofs-main.o -Wl,--as-needed ../lib/.libs/liberofs.a -luuid
> /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../lib/.libs/liberofs.a(liberofs_la-config.o): in function `erofs_exit_configure':
> config.c:(.text+0xe2): undefined reference to `selabel_close'
> /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../lib/.libs/liberofs.a(liberofs_la-config.o): in function `erofs_selabel_open':
> config.c:(.text+0x180): undefined reference to `selabel_open'
> collect2: error: ld returned 1 exit status
>
> Should it just link libselinux to fix the build?
Many thanks for the patch! My nightly CI environment doesn't cover selinux build yet.
It should be fixed.
Thanks,
Gao Xiang
>
> Thanks.
>
> David
>
> dump/Makefile.am | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dump/Makefile.am b/dump/Makefile.am
> index 0bb7b4e..f0246d7 100644
> --- a/dump/Makefile.am
> +++ b/dump/Makefile.am
> @@ -6,4 +6,4 @@ bin_PROGRAMS = dump.erofs
> AM_CPPFLAGS = ${libuuid_CFLAGS}
> dump_erofs_SOURCES = main.c
> dump_erofs_CFLAGS = -Wall -Werror -I$(top_srcdir)/include
> -dump_erofs_LDADD = $(top_builddir)/lib/liberofs.la ${libuuid_LIBS}
> \ No newline at end of file
> +dump_erofs_LDADD = $(top_builddir)/lib/liberofs.la ${libselinux_LIBS} ${libuuid_LIBS}
> --
> 2.31.1
More information about the Linux-erofs
mailing list