All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: fuse: fix linking when using --with-selinux
@ 2020-12-11  2:29 David Michael
  2020-12-11  2:37 ` Gao Xiang
  2020-12-12  9:49 ` Li GuiFu via Linux-erofs
  0 siblings, 2 replies; 3+ messages in thread
From: David Michael @ 2020-12-11  2:29 UTC (permalink / raw)
  To: linux-erofs, bluce.liguifu, miaoxie, fangwei1; +Cc: gaoxiang25

The libselinux functions selabel_open and selabel_close are called
by lib/config.c, so include libselinux in CFLAGS and LIBS to fix
building erofsfuse.

Signed-off-by: David Michael <fedora.dm0@gmail.com>
---

Hi,

Trying to build both mkfs.erofs with SELinux and erofsfuse at the same
time (with both --enable-fuse and --with-selinux) results in the
following linking errors:

/usr/bin/ld: ../lib/.libs/liberofs.a(liberofs_la-config.o): in function `erofs_selabel_open':
/home/dm0/rpmbuild/BUILD/erofs-utils-1.2/lib/config.c:75: undefined reference to `selabel_open'
/usr/bin/ld: ../lib/.libs/liberofs.a(liberofs_la-config.o): in function `erofs_exit_configure':
/home/dm0/rpmbuild/BUILD/erofs-utils-1.2/lib/config.c:42: undefined reference to `selabel_close'

Are these programs supposed to be configured separately?  If this build
configuration is supposed to work, this change fixes linking.

Thanks.

David

 fuse/Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fuse/Makefile.am b/fuse/Makefile.am
index f14f6fd..e7757bc 100644
--- a/fuse/Makefile.am
+++ b/fuse/Makefile.am
@@ -5,6 +5,6 @@ AUTOMAKE_OPTIONS = foreign
 bin_PROGRAMS     = erofsfuse
 erofsfuse_SOURCES = dir.c main.c
 erofsfuse_CFLAGS = -Wall -Werror -I$(top_srcdir)/include
-erofsfuse_CFLAGS += -DFUSE_USE_VERSION=26 ${libfuse_CFLAGS}
-erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse_LIBS} ${liblz4_LIBS}
+erofsfuse_CFLAGS += -DFUSE_USE_VERSION=26 ${libfuse_CFLAGS} ${libselinux_CFLAGS}
+erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse_LIBS} ${liblz4_LIBS} ${libselinux_LIBS}
 
-- 
2.29.2

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

* Re: [PATCH] erofs-utils: fuse: fix linking when using --with-selinux
  2020-12-11  2:29 [PATCH] erofs-utils: fuse: fix linking when using --with-selinux David Michael
@ 2020-12-11  2:37 ` Gao Xiang
  2020-12-12  9:49 ` Li GuiFu via Linux-erofs
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2020-12-11  2:37 UTC (permalink / raw)
  To: David Michael; +Cc: gaoxiang25, miaoxie, linux-erofs

Hi David,

On Thu, Dec 10, 2020 at 09:29:43PM -0500, 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 erofsfuse.
> 
> Signed-off-by: David Michael <fedora.dm0@gmail.com>
> ---
> 
> Hi,
> 
> Trying to build both mkfs.erofs with SELinux and erofsfuse at the same
> time (with both --enable-fuse and --with-selinux) results in the
> following linking errors:
> 
> /usr/bin/ld: ../lib/.libs/liberofs.a(liberofs_la-config.o): in function `erofs_selabel_open':
> /home/dm0/rpmbuild/BUILD/erofs-utils-1.2/lib/config.c:75: undefined reference to `selabel_open'
> /usr/bin/ld: ../lib/.libs/liberofs.a(liberofs_la-config.o): in function `erofs_exit_configure':
> /home/dm0/rpmbuild/BUILD/erofs-utils-1.2/lib/config.c:42: undefined reference to `selabel_close'

Many thanks for your patch! I tested with limited compilation options
before, that is why I'm now worrying about compile error after 1.2 release :(
(I may need to release some 1.2.1 when these build errors are all gone.)

> 
> Are these programs supposed to be configured separately?  If this build
> configuration is supposed to work, this change fixes linking.

It shouldn't supposed to be configured separately, but I'm not sure how
to add them to liberofs as a whole decently (I mean with automake/libtool
infrastructure)... (and there was a trick to staticly build lz4-1.8.x
correctly which should work fine as well :(....)

Thanks,
Gao Xiang

> 
> Thanks.
> 
> David
> 
>  fuse/Makefile.am | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fuse/Makefile.am b/fuse/Makefile.am
> index f14f6fd..e7757bc 100644
> --- a/fuse/Makefile.am
> +++ b/fuse/Makefile.am
> @@ -5,6 +5,6 @@ AUTOMAKE_OPTIONS = foreign
>  bin_PROGRAMS     = erofsfuse
>  erofsfuse_SOURCES = dir.c main.c
>  erofsfuse_CFLAGS = -Wall -Werror -I$(top_srcdir)/include
> -erofsfuse_CFLAGS += -DFUSE_USE_VERSION=26 ${libfuse_CFLAGS}
> -erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse_LIBS} ${liblz4_LIBS}
> +erofsfuse_CFLAGS += -DFUSE_USE_VERSION=26 ${libfuse_CFLAGS} ${libselinux_CFLAGS}
> +erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse_LIBS} ${liblz4_LIBS} ${libselinux_LIBS}
>  
> -- 
> 2.29.2
> 


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

* Re: [PATCH] erofs-utils: fuse: fix linking when using --with-selinux
  2020-12-11  2:29 [PATCH] erofs-utils: fuse: fix linking when using --with-selinux David Michael
  2020-12-11  2:37 ` Gao Xiang
@ 2020-12-12  9:49 ` Li GuiFu via Linux-erofs
  1 sibling, 0 replies; 3+ messages in thread
From: Li GuiFu via Linux-erofs @ 2020-12-12  9:49 UTC (permalink / raw)
  To: David Michael, linux-erofs, bluce.liguifu, miaoxie, fangwei1; +Cc: gaoxiang25



On 2020/12/11 10:29, 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 erofsfuse.
> 
> Signed-off-by: David Michael <fedora.dm0@gmail.com>
> ---
> 
> Hi,
> 
> Trying to build both mkfs.erofs with SELinux and erofsfuse at the same
> time (with both --enable-fuse and --with-selinux) results in the
> following linking errors:
> 
> /usr/bin/ld: ../lib/.libs/liberofs.a(liberofs_la-config.o): in function `erofs_selabel_open':
> /home/dm0/rpmbuild/BUILD/erofs-utils-1.2/lib/config.c:75: undefined reference to `selabel_open'
> /usr/bin/ld: ../lib/.libs/liberofs.a(liberofs_la-config.o): in function `erofs_exit_configure':
> /home/dm0/rpmbuild/BUILD/erofs-utils-1.2/lib/config.c:42: undefined reference to `selabel_close'
> 
> Are these programs supposed to be configured separately?  If this build
> configuration is supposed to work, this change fixes linking.
> 
> Thanks.
> 
> David
> 
>  fuse/Makefile.am | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
It's fixed
Reviewed-by: Li Guifu <bluce.lee@aliyun.com>
Tested-by: Li Guifu <bluce.lee@aliyun.com>
Thanks,


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

end of thread, other threads:[~2020-12-12  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11  2:29 [PATCH] erofs-utils: fuse: fix linking when using --with-selinux David Michael
2020-12-11  2:37 ` Gao Xiang
2020-12-12  9:49 ` Li GuiFu via Linux-erofs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.