erofs-utils: dump: fix linking when using --with-selinux
PATCH 1/1 erofs-utils: dump: fix linking when using --with-selinux
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.
---
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?
Thanks.
David
dump/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
dump/Makefile.am +1 -1
@@ -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} +dump_erofs_LDADD = $(top_builddir)/lib/liberofs.la ${libselinux_LIBS} ${libuuid_LIBS}
Signature · 1 line
2.31.1
Hi David,
Quoted 19 lines · David Michael
The libselinux functions
selabel_openandselabel_closeare called bylib/config.c, so include libselinux in CFLAGS and LIBS to fix building dump.erofs.Signed-off-by David Michael <[email protected]>---
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 toselabel_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 functionerofs_selabel_open':
config.c:(.text+0x180): undefined reference to `selabel_open'
collect2: error: ld returned 1 exit status
Quoted 1 line
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
Quoted 21 lines
Thanks.
David
dump/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)dump/Makefile.am +1
-1@@ -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} +dump_erofs_LDADD = $(top_builddir)/lib/liberofs.la ${libselinux_LIBS} ${libuuid_LIBS}Signature · 1 line
2.31.1