Skip to contentSkip to conversation

libselinux: utils: link with shared libfts

PATCH In review Đoàn Trần Công Danh 2 participants 3 messages May 22, 2020 – May 23, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: utils: link with shared libfts

On Linux with musl libc, libfts isn't shipped with libc. Hence, we link with $(FTS_LIBS) in src.

Some (most) musl-based distribution choose to ship libfts as a standalone shared object because their libfts is licensed under either very permissive license or that implementation of libfts requires attribution in every usage.

Always link with $(FTS_LIBS) in utils to prevent undefined reference problem on those platforms.

---
 libselinux/utils/Makefile | 2 ++
 1 file changed, 2 insertions(+)
libselinux/utils/Makefile +2 -0
index aa2d3e1b..1a7da223 100644
@@ -45,6 +45,8 @@ override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS)
 override LDFLAGS += -L../src
 override LDLIBS += -lselinux $(FTS_LDLIBS)
 PCRE_LDLIBS ?= -lpcre
+FTS_LDLIBS ?=
+override LDLIBS += $(FTS_LDLIBS)
 
 ifeq ($(ANDROID_HOST),y)
 TARGETS=sefcontext_compile
Signature · 1 line
2.26.2.672.g232c24e857
#1 lore raw
Quoted 22 lines · Đoàn Trần Công Danh

On Linux with musl libc, libfts isn't shipped with libc. Hence, we link with $(FTS_LIBS) in src.

Some (most) musl-based distribution choose to ship libfts as a standalone shared object because their libfts is licensed under either very permissive license or that implementation of libfts requires attribution in every usage.

Always link with $(FTS_LIBS) in utils to prevent undefined reference problem on those platforms.

---
 libselinux/utils/Makefile | 2 ++
 1 file changed, 2 insertions(+)
libselinux/utils/Makefile +0 -0
index aa2d3e1b..1a7da223 100644

libselinux/utils/Makefile override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) · line 49

Quoted 5 lines
libselinux/utils/Makefile +2 -0
@@ -45,6 +45,8 @@ override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS)
 override LDFLAGS += -L../src
 override LDLIBS += -lselinux $(FTS_LDLIBS)
 PCRE_LDLIBS ?= -lpcre
+FTS_LDLIBS ?=
+override LDLIBS += $(FTS_LDLIBS)

Hello,
A few lines above there already is "override LDLIBS += -lselinux $(FTS_LDLIBS)". Why do you need to add $(FTS_LDLIBS) to LDLIBS again?

Thanks,
Nicolas

#2 lore raw

Hello Nicolas,

Quoted 3 lines · Nicolas Iooss

Hello,
A few lines above there already is "override LDLIBS += -lselinux $(FTS_LDLIBS)". Why do you need to add $(FTS_LDLIBS) to LDLIBS again?

Sorry for the noise, I patched this for libselinux 3.0.

It's was applied cleanly on master, hence I didn't check again.

Signature · 1 line
Danh