Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Michael <fedora.dm0@gmail.com>
To: linux-erofs@lists.ozlabs.org, bluce.liguifu@huawei.com,
	miaoxie@huawei.com, fangwei1@huawei.com
Cc: yuchao0@huawei.com
Subject: [PATCH] erofs-utils: dump: fix linking when using --with-selinux
Date: Sat, 02 Oct 2021 18:38:57 -0400	[thread overview]
Message-ID: <875yufoxvi.fsf@gmail.com> (raw)

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

             reply	other threads:[~2021-10-02 22:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02 22:38 David Michael [this message]
2021-10-03  4:41 ` [PATCH] erofs-utils: dump: fix linking when using --with-selinux Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yufoxvi.fsf@gmail.com \
    --to=fedora.dm0@gmail.com \
    --cc=bluce.liguifu@huawei.com \
    --cc=fangwei1@huawei.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=miaoxie@huawei.com \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox