libsepol: Add INCLUDEDIR to utils/Makefile
PATCH 1/1 libsepol: Add INCLUDEDIR to utils/Makefile
fcb5d5c removed ../include from CFLAGS from libsepol/utils/Makefile so that a build tool can't find sepol/sepol.h when libsepol is built on a system without sepol.h in standard paths.
Fixes:
chkcon.c:1:10: fatal error: sepol/sepol.h: No such file or directory
#include <sepol/sepol.h>
--- libsepol/utils/Makefile | 1 + 1 file changed, 1 insertion(+)
libsepol/utils/Makefile +1 -0
@@ -1,6 +1,7 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr BINDIR ?= $(PREFIX)/bin +INCLUDEDIR ?= $(PREFIX)/include CFLAGS ?= -Wall -Werror LDFLAGS += -L../src
Signature · 1 line
2.12.2
The patch is wrong, please disregard.
I'm not sure about the right fix in order not to break gentoo use case. I'd just revert fcb5d5c change in libsepol/utils/Makefile for now.
Quoted 26 lines · Petr Lautrbach
fcb5d5c removed ../include from CFLAGS from libsepol/utils/Makefile so that a build tool can't find
sepol/sepol.hwhen libsepol is built on a system withoutsepol.hin standard paths.Fixes:
chkcon.c:1:10: fatal error:sepol/sepol.h: No such file or directory
#include <sepol/sepol.h>Signed-off-by Petr Lautrbach <[email protected]>--- libsepol/utils/Makefile | 1 + 1 file changed, 1 insertion(+)libsepol/utils/Makefile +1
-0@@ -1,6 +1,7 @@ # Installation directories. PREFIX ?= $(DESTDIR)/usr BINDIR ?= $(PREFIX)/bin +INCLUDEDIR ?= $(PREFIX)/include CFLAGS ?= -Wall -Werror LDFLAGS += -L../src
Quoted 5 lines · Petr Lautrbach
The patch is wrong, please disregard.
I'm not sure about the right fix in order not to break gentoo use case.
I'd just revert fcb5d5c change in libsepol/utils/Makefile for now.
Can't you just specify CFLAGS to make, similar to what is done in the top-level Makefile for building with DESTDIR set?
Quoted 35 lines · Petr Lautrbach
Quoted 29 lines
fcb5d5c removed ../include from CFLAGS from libsepol/utils/Makefile so
that a build tool can't findsepol/sepol.hwhen libsepol is built on a
system withoutsepol.hin standard paths.Fixes:
chkcon.c:1:10: fatal error:sepol/sepol.h: No such file or directory
#include <sepol/sepol.h>Signed-off-by Petr Lautrbach <[email protected]>---
libsepol/utils/Makefile | 1 +1 file changed, 1 insertion(+)libsepol/utils/Makefile +0
-0@@ -1,6 +1,7 @@ # Installation directories.PREFIX ?= $(DESTDIR)/usr
BINDIR ?= $(PREFIX)/bin
+INCLUDEDIR ?= $(PREFIX)/include
CFLAGS ?= -Wall -Werror
LDFLAGS += -L../src
Dne 4.5.2017 v 22:49 Stephen Smalley napsal(a):
Quoted 10 lines · Petr Lautrbach
Quoted 5 lines
The patch is wrong, please disregard.
I'm not sure about the right fix in order not to break gentoo use case.
I'd just revert fcb5d5c change in libsepol/utils/Makefile for now.Can't you just specify CFLAGS to make, similar to what is done in the top-level
Makefilefor building with DESTDIR set?
I believe that ../include and ../src paths should be always added to CFLAGS and LDFLAGS in this case to prevent cases when LDFLAGS and CFLAGS are overriden on a command line without setting paths containing sepol.h and sepol.so.
This way it's already used in libsepol/src/Makefile
Petr
PATCH 1/1 libsepol/utils: Fix build without system sepol.h
fcb5d5c removed ../include from CFLAGS from libsepol/utils/Makefile so that a build tool can't find sepol/sepol.h when only libsepol is built and a system is without sepol.h in standard paths. It should use its own sepol.h file during build. oveeride needs to be used in order not to be overridden by values provided on a command line. Same problem applies to LDFLAGS.
Fixes:
$ make CFLAGS="" LDFLAGS="" make[1]: Entering directory '/root/selinux/libsepol/utils' cc chkcon.c -lsepol -o chkcon chkcon.c:1:25: fatal error: sepol/sepol.h: No such file or directory #include <sepol/sepol.h>
$ make CFLAGS="" LDFLAGS="" ... make -C utils make[1]: Entering directory '/root/selinux/libsepol/utils' cc -I../include chkcon.c -lsepol -o chkcon /usr/bin/ld: cannot find -lsepol collect2: error: ld returned 1 exit status
--- libsepol/utils/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
libsepol/utils/Makefile +2 -1
@@ -3,7 +3,8 @@ PREFIX ?= $(DESTDIR)/usr BINDIR ?= $(PREFIX)/bin CFLAGS ?= -Wall -Werror -LDFLAGS += -L../src +override CFLAGS += -I../include +override LDFLAGS += -L../src LDLIBS += -lsepol TARGETS=$(patsubst %.c,%,$(wildcard *.c))
Signature · 1 line
2.12.2
Stephen Smalley
AppliedRe: [PATCH] libsepol/utils: Fix build without system sepol.h
Quoted 19 lines · Petr Lautrbach
fcb5d5c removed ../include from CFLAGS from libsepol/utils/Makefile so
that a build tool can't findsepol/sepol.hwhen only libsepol is built
and a system is withoutsepol.hin standard paths. It should use its ownsepol.hfile during build.oveerideneeds to be used in order not to
be overridden by values provided on a command line. Same problem applies
to LDFLAGS.Fixes:
$ make CFLAGS="" LDFLAGS="" make[1]: Entering directory '/root/selinux/libsepol/utils' cc chkcon.c -lsepol -o chkcon chkcon.c:1:25: fatal error: sepol/sepol.h: No such file or directory #include <sepol/sepol.h>
Quoted 7 lines
$ make CFLAGS="" LDFLAGS="" ... make -C utils make[1]: Entering directory '/root/selinux/libsepol/utils' cc -I../include chkcon.c -lsepol -o chkcon /usr/bin/ld: cannot find -lsepol collect2: error: ld returned 1 exit status
Thanks, applied
Quoted 20 lines
Signed-off-by Petr Lautrbach <[email protected]>---
libsepol/utils/Makefile | 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)libsepol/utils/Makefile +0
-0@@ -3,7 +3,8 @@ PREFIX ?= $(DESTDIR)/usrBINDIR ?= $(PREFIX)/bin
CFLAGS ?= -Wall -Werrorlibsepol/utils/Makefile +2
-1-LDFLAGS += -L../src +override CFLAGS += -I../include +override LDFLAGS += -L../srcLDLIBS += -lsepol
TARGETS=$(patsubst %.c,%,$(wildcard *.c))