Skip to contentSkip to conversation

Error building the userspace tools

PATCH James Carter 2 participants 4 messages Jan 6, 2010 – Jan 8, 2010 SELinux security module

lore
Share & tools
lore
#0 lore raw

I don't know what the correct fix for this is, but when I make the userspace tools with "make LIBDIR=/usr/lib64 SHLIBDIR=/lib64", I need the patch below for everything to compile.

What I don't know is:
1) Why is this only required when I am specifying lib64?
2) Since it is libsemanage that is using libustr and libbz2, why does semodule and setsebool need to specify them?

This occurs on Fedora 12. Is the problem due to a difference in the way Fedora is building the userspace tools?

policycoreutils/semodule/Makefile +1 -1
index c96a286..feba570 100644
@@ -7,7 +7,7 @@ LIBDIR ?= ${PREFIX}/lib
 
 CFLAGS ?= -Werror -Wall -W
 override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lustr -lbz2 -lsepol -lselinux -lsemanage -L$(LIBDIR)
 SEMODULE_OBJS = semodule.o
 
 all: semodule
policycoreutils/setsebool/Makefile +1 -1
index 556b780..214abc3 100644
@@ -7,7 +7,7 @@ LIBDIR ?= ${PREFIX}/lib
 
 CFLAGS ?= -Werror -Wall -W
 override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lustr -lbz2 -lsepol -lselinux -lsemanage -L$(LIBDIR)
 SETSEBOOL_OBJS = setsebool.o
 
 all: setsebool
Signature · 8 lines
James Carter <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 32 lines · James Carter

I don't know what the correct fix for this is, but when I make the userspace tools with "make LIBDIR=/usr/lib64 SHLIBDIR=/lib64", I need the patch below for everything to compile.

What I don't know is:
1) Why is this only required when I am specifying lib64?
2) Since it is libsemanage that is using libustr and libbz2, why does semodule and setsebool need to specify them?

This occurs on Fedora 12. Is the problem due to a difference in the way Fedora is building the userspace tools?

policycoreutils/semodule/Makefile +1 -1
index c96a286..feba570 100644
@@ -7,7 +7,7 @@ LIBDIR ?= ${PREFIX}/lib
 
  CFLAGS ?= -Werror -Wall -W
  override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lustr -lbz2 -lsepol -lselinux -lsemanage -L$(LIBDIR)
  SEMODULE_OBJS = semodule.o
 
  all: semodule
policycoreutils/setsebool/Makefile +0 -0
index 556b780..214abc3 100644

policycoreutils/setsebool/Makefile LIBDIR ?= ${PREFIX}/lib · line 13

Quoted 8 lines
policycoreutils/setsebool/Makefile +1 -1
@@ -7,7 +7,7 @@ LIBDIR ?= ${PREFIX}/lib
 
  CFLAGS ?= -Werror -Wall -W
  override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lustr -lbz2 -lsepol -lselinux -lsemanage -L$(LIBDIR)
  SETSEBOOL_OBJS = setsebool.o
 
  all: setsebool

I'm wondering if you
commit 55648 is the reason
for the error your getting.

from over here your make commands
look as it should.

Justin P. Mattock

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 40 lines · Justin P. Mattock
Quoted 39 lines · James Carter

I don't know what the correct fix for this is, but when I make the userspace tools with "make LIBDIR=/usr/lib64 SHLIBDIR=/lib64", I need the patch below for everything to compile.

What I don't know is:
1) Why is this only required when I am specifying lib64?
2) Since it is libsemanage that is using libustr and libbz2, why does semodule and setsebool need to specify them?

This occurs on Fedora 12. Is the problem due to a difference in the way Fedora is building the userspace tools?

policycoreutils/semodule/Makefile +1 -1
index c96a286..feba570 100644
@@ -7,7 +7,7 @@ LIBDIR ?= ${PREFIX}/lib
 
  CFLAGS ?= -Werror -Wall -W
  override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lustr -lbz2 -lsepol -lselinux -lsemanage -L$(LIBDIR)
  SEMODULE_OBJS = semodule.o
 
  all: semodule
policycoreutils/setsebool/Makefile +1 -1
index 556b780..214abc3 100644
@@ -7,7 +7,7 @@ LIBDIR ?= ${PREFIX}/lib
 
  CFLAGS ?= -Werror -Wall -W
  override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lustr -lbz2 -lsepol -lselinux -lsemanage -L$(LIBDIR)
  SETSEBOOL_OBJS = setsebool.o
 
Quoted 9 lines

policycoreutils/setsebool/Makefile LIBDIR ?= ${PREFIX}/lib · line 13

Quoted 1 line
policycoreutils/setsebool/Makefile +0 -0
  all: setsebool

I'm wondering if you
commit 55648 is the reason for the error your getting.

from over here your make commands look as it should.

Looking at it again. The problem is that when I specify LIBDIR and SHLIBDIR, semodule and setsebool are linked against the static libsemanage library.

An additional problem is that the creation of the link to libsemanage.so.1 fails.

This patch seems to fix these two problems

libsemanage/src/Makefile +1 -1
index 67afc60..137af40 100644
@@ -127,7 +127,7 @@ install: all
 	test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
 	install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig
 	test -f $(DEFAULT_SEMANAGE_CONF_LOCATION) || install -m 644 -D semanage.conf $(DEFAULT_SEMANAGE_CONF_LOCATION)
-	cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
+	cd $(SHLIBDIR) && ln -sf $(LIBSO) $(TARGET)
 
 install-pywrap: pywrap 
 	test -d $(PYLIBDIR)/site-packages || install -m 755 -d $(PYLIBDIR)/site-packages
policycoreutils/semodule/Makefile +2 -1
index c96a286..1ab1f57 100644
@@ -4,10 +4,11 @@ INCLUDEDIR ?= $(PREFIX)/include
 SBINDIR ?= $(PREFIX)/sbin
 MANDIR = $(PREFIX)/share/man
 LIBDIR ?= ${PREFIX}/lib
+SHLIBDIR ?= $(PREFIX)/lib
 
 CFLAGS ?= -Werror -Wall -W
 override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lsepol -lselinux -lsemanage -L$(SHLIBDIR)
 SEMODULE_OBJS = semodule.o
 
 all: semodule
policycoreutils/setsebool/Makefile +2 -1
index 556b780..17f96d9 100644
@@ -4,10 +4,11 @@ INCLUDEDIR ?= $(PREFIX)/include
 SBINDIR ?= $(PREFIX)/sbin
 MANDIR = $(PREFIX)/share/man
 LIBDIR ?= ${PREFIX}/lib
+SHLIBDIR ?= $(PREFIX)/lib
 
 CFLAGS ?= -Werror -Wall -W
 override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lsepol -lselinux -lsemanage -L$(SHLIBDIR)
 SETSEBOOL_OBJS = setsebool.o
 
 all: setsebool
Signature · 8 lines
James Carter <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
Quoted 97 lines · James Carter
Quoted 40 lines · Justin P. Mattock
Quoted 39 lines · James Carter

I don't know what the correct fix for this is, but when I make the userspace tools with "make LIBDIR=/usr/lib64 SHLIBDIR=/lib64", I need the patch below for everything to compile.

What I don't know is:
1) Why is this only required when I am specifying lib64?
2) Since it is libsemanage that is using libustr and libbz2, why does semodule and setsebool need to specify them?

This occurs on Fedora 12. Is the problem due to a difference in the way Fedora is building the userspace tools?

policycoreutils/semodule/Makefile +1 -1
index c96a286..feba570 100644
@@ -7,7 +7,7 @@ LIBDIR ?= ${PREFIX}/lib
 
   CFLAGS ?= -Werror -Wall -W
   override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lustr -lbz2 -lsepol -lselinux -lsemanage -L$(LIBDIR)
   SEMODULE_OBJS = semodule.o
 
   all: semodule
policycoreutils/setsebool/Makefile +1 -1
index 556b780..214abc3 100644
@@ -7,7 +7,7 @@ LIBDIR ?= ${PREFIX}/lib
 
   CFLAGS ?= -Werror -Wall -W
   override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lustr -lbz2 -lsepol -lselinux -lsemanage -L$(LIBDIR)
   SETSEBOOL_OBJS = setsebool.o
 
Quoted 9 lines

policycoreutils/setsebool/Makefile INCLUDEDIR ?= $(PREFIX)/include · line 14

Quoted 1 line
policycoreutils/setsebool/Makefile +0 -0
   all: setsebool

I'm wondering if you
commit 55648 is the reason for the error your getting.

from over here your make commands look as it should.

Looking at it again. The problem is that when I specify LIBDIR and SHLIBDIR, semodule and setsebool are linked against the static libsemanage library.

An additional problem is that the creation of the link to libsemanage.so.1 fails.

This patch seems to fix these two problems

libsemanage/src/Makefile +1 -1
index 67afc60..137af40 100644
@@ -127,7 +127,7 @@ install: all
  	test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
  	install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig
  	test -f $(DEFAULT_SEMANAGE_CONF_LOCATION) || install -m 644 -D semanage.conf $(DEFAULT_SEMANAGE_CONF_LOCATION)
-	cd $(LIBDIR)&&  ln -sf $(LIBSO) $(TARGET)
+	cd $(SHLIBDIR)&&  ln -sf $(LIBSO) $(TARGET)
 
  install-pywrap: pywrap
  	test -d $(PYLIBDIR)/site-packages || install -m 755 -d $(PYLIBDIR)/site-packages
policycoreutils/semodule/Makefile +2 -1
index c96a286..1ab1f57 100644
@@ -4,10 +4,11 @@ INCLUDEDIR ?= $(PREFIX)/include
  SBINDIR ?= $(PREFIX)/sbin
  MANDIR = $(PREFIX)/share/man
  LIBDIR ?= ${PREFIX}/lib
+SHLIBDIR ?= $(PREFIX)/lib
 
  CFLAGS ?= -Werror -Wall -W
  override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lsepol -lselinux -lsemanage -L$(SHLIBDIR)
  SEMODULE_OBJS = semodule.o
 
  all: semodule
policycoreutils/setsebool/Makefile +0 -0
index 556b780..17f96d9 100644
@@ -4,10 +4,11 @@ INCLUDEDIR ?= $(PREFIX)/include
  SBINDIR ?= $(PREFIX)/sbin
  MANDIR = $(PREFIX)/share/man

policycoreutils/setsebool/Makefile INCLUDEDIR ?= $(PREFIX)/include · line 14

Quoted 10 lines
policycoreutils/setsebool/Makefile +2 -1
  LIBDIR ?= ${PREFIX}/lib
+SHLIBDIR ?= $(PREFIX)/lib
 
  CFLAGS ?= -Werror -Wall -W
  override CFLAGS += -I$(INCLUDEDIR)
-LDLIBS = -lsepol -lselinux -lsemanage -L$(LIBDIR)
+LDLIBS = -lsepol -lselinux -lsemanage -L$(SHLIBDIR)
  SETSEBOOL_OBJS = setsebool.o
 
  all: setsebool

cool glad you got it..
just noticed /lib/semanage.so
and /usr/lib/libsemamage* (over here)

I'm wondering if there should be some
rm -R /lib/libsemanage* in the Makefile,for the old lib so people don't have to manually rm it?

but then again how hard is it
rm /lib/libsemanage*

Justin P. Mattock

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.