Skip to contentSkip to conversation

policycoreutils: make `-laudit -lbz2` conditional

PATCH In review Petr Lautrbach 2 participants 4 messages Jun 23, 2025 – Jul 2, 2025 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 policycoreutils: make `-laudit -lbz2` conditional

Commit da6cd3d8d7600 ("Support static-only builds") introduced possibility to build static-only toolchain. For static builds of semodule and setsebool seems to be necessary to use -laudit -lbz2. As an side effect, when policycoreutils is built without other components, the buildroot requires libaudit.so and libbz2.so to be available. For shared builds this is not necessary and had not been required before.

---

v2: fixed indentation, I was inspired by the wrong file :/

 policycoreutils/semodule/Makefile  | 2 ++
 policycoreutils/setsebool/Makefile | 2 ++
 2 files changed, 4 insertions(+)
policycoreutils/semodule/Makefile +2 -0
index 7c45831fcd4e..52a68dfcac10 100644
@@ -12,7 +12,9 @@ SEMODULE_OBJS = semodule.o
 
 all: semodule genhomedircon
 
+ifeq ($(DISABLE_SHARED),y)
 semodule: LDLIBS += -laudit -lbz2
+endif
 semodule: $(SEMODULE_OBJS)
 
 genhomedircon:
policycoreutils/setsebool/Makefile +2 -0
index 1d5148469f01..f68440f90df7 100644
@@ -15,7 +15,9 @@ BASHCOMPLETIONS=setsebool-bash-completion.sh
 
 all: setsebool
 
+ifeq ($(DISABLE_SHARED),y)
 setsebool: LDLIBS += -laudit -lbz2
+endif
 setsebool: $(SETSEBOOL_OBJS)
 
 install: all
Signature · 1 line
2.49.0
Acked-by on v2 1/1
#1 lore raw
Quoted 9 lines · Petr Lautrbach

Commit da6cd3d8d7600 ("Support static-only builds") introduced possibility to build static-only toolchain. For static builds of semodule and setsebool seems to be necessary to use -laudit -lbz2. As an side effect, when policycoreutils is built without other components, the buildroot requires libaudit.so and libbz2.so to be available. For shared builds this is not necessary and had not been required before.

Quoted 40 lines

---

v2: fixed indentation, I was inspired by the wrong file :/

 policycoreutils/semodule/Makefile  | 2 ++
 policycoreutils/setsebool/Makefile | 2 ++
 2 files changed, 4 insertions(+)
policycoreutils/semodule/Makefile +2 -0
index 7c45831fcd4e..52a68dfcac10 100644
@@ -12,7 +12,9 @@ SEMODULE_OBJS = semodule.o
 
 all: semodule genhomedircon
 
+ifeq ($(DISABLE_SHARED),y)
 semodule: LDLIBS += -laudit -lbz2
+endif
 semodule: $(SEMODULE_OBJS)
 
 genhomedircon:
policycoreutils/setsebool/Makefile +2 -1
index 1d5148469f01..f68440f90df7 100644
@@ -15,7 +15,9 @@ BASHCOMPLETIONS=setsebool-bash-completion.sh
 
 all: setsebool
 
+ifeq ($(DISABLE_SHARED),y)
 setsebool: LDLIBS += -laudit -lbz2
+endif
 setsebool: $(SETSEBOOL_OBJS)
 
 install: all
--

2.49.0

#2 lore raw
Quoted 10 lines · James Carter
Quoted 8 lines · Petr Lautrbach

Commit da6cd3d8d7600 ("Support static-only builds") introduced possibility to build static-only toolchain. For static builds of semodule and setsebool seems to be necessary to use -laudit -lbz2. As an side effect, when policycoreutils is built without other components, the buildroot requires libaudit.so and libbz2.so to be available. For shared builds this is not necessary and had not been required before.

Quoted 4 lines
Quoted 1 line

I think this has been superseded by Alyssa's and my patches. Correct?
Jim

Quoted 40 lines
Quoted 40 lines

---

v2: fixed indentation, I was inspired by the wrong file :/

 policycoreutils/semodule/Makefile  | 2 ++
 policycoreutils/setsebool/Makefile | 2 ++
 2 files changed, 4 insertions(+)
policycoreutils/semodule/Makefile +2 -0
index 7c45831fcd4e..52a68dfcac10 100644
@@ -12,7 +12,9 @@ SEMODULE_OBJS = semodule.o
 
 all: semodule genhomedircon
 
+ifeq ($(DISABLE_SHARED),y)
 semodule: LDLIBS += -laudit -lbz2
+endif
 semodule: $(SEMODULE_OBJS)
 
 genhomedircon:
policycoreutils/setsebool/Makefile +2 -1
index 1d5148469f01..f68440f90df7 100644
@@ -15,7 +15,9 @@ BASHCOMPLETIONS=setsebool-bash-completion.sh
 
 all: setsebool
 
+ifeq ($(DISABLE_SHARED),y)
 setsebool: LDLIBS += -laudit -lbz2
+endif
 setsebool: $(SETSEBOOL_OBJS)
 
 install: all
--

2.49.0

#3 lore raw
Quoted 11 lines · James Carter
Quoted 10 lines · James Carter
Quoted 8 lines · Petr Lautrbach

Commit da6cd3d8d7600 ("Support static-only builds") introduced possibility to build static-only toolchain. For static builds of semodule and setsebool seems to be necessary to use -laudit -lbz2. As an side effect, when policycoreutils is built without other components, the buildroot requires libaudit.so and libbz2.so to be available. For shared builds this is not necessary and had not been required before.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I think this has been superseded by Alyssa's and my patches. Correct?
Jim

Correct.

I'm able to build policycoreutils with Alyssa's and my patches and without this patch.

Thanks!.

Quoted 41 lines
Quoted 41 lines
Quoted 41 lines

---

v2: fixed indentation, I was inspired by the wrong file :/

 policycoreutils/semodule/Makefile  | 2 ++
 policycoreutils/setsebool/Makefile | 2 ++
 2 files changed, 4 insertions(+)
policycoreutils/semodule/Makefile +2 -0
index 7c45831fcd4e..52a68dfcac10 100644
@@ -12,7 +12,9 @@ SEMODULE_OBJS = semodule.o
 
 all: semodule genhomedircon
 
+ifeq ($(DISABLE_SHARED),y)
 semodule: LDLIBS += -laudit -lbz2
+endif
 semodule: $(SEMODULE_OBJS)
 
 genhomedircon:
policycoreutils/setsebool/Makefile +2 -1
index 1d5148469f01..f68440f90df7 100644
@@ -15,7 +15,9 @@ BASHCOMPLETIONS=setsebool-bash-completion.sh
 
 all: setsebool
 
+ifeq ($(DISABLE_SHARED),y)
 setsebool: LDLIBS += -laudit -lbz2
+endif
 setsebool: $(SETSEBOOL_OBJS)
 
 install: all
--

2.49.0