linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: dump: fix linking when using --with-selinux
@ 2021-10-02 22:38 David Michael
  2021-10-03  4:41 ` Gao Xiang
  0 siblings, 1 reply; 2+ messages in thread
From: David Michael @ 2021-10-02 22:38 UTC (permalink / raw)
  To: linux-erofs, bluce.liguifu, miaoxie, fangwei1; +Cc: yuchao0

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@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?

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] erofs-utils: dump: fix linking when using --with-selinux
  2021-10-02 22:38 [PATCH] erofs-utils: dump: fix linking when using --with-selinux David Michael
@ 2021-10-03  4:41 ` Gao Xiang
  0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2021-10-03  4:41 UTC (permalink / raw)
  To: David Michael; +Cc: linux-erofs, yuchao0, bluce.liguifu, miaoxie

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@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-03  4:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 22:38 [PATCH] erofs-utils: dump: fix linking when using --with-selinux David Michael
2021-10-03  4:41 ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).