Skip to contentSkip to conversation

libselinux/load_policy.o compile error

PATCH In review Vikram Noel Ambrose 2 participants 6 messages Sep 4, 2008 – Sep 26, 2008 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux/load_policy.o compile error

Here's the fix to that libselinux ld error you were getting.

Vikram

#1 lore raw
Quoted 2 lines · Vikram Noel Ambrose

Here's the fix to that libselinux ld error you were getting.

Ok, applied and built fine. One interesting thing is that even without building the swig wrappers (--disable-swig) it still installs lib/python2.5/site-packages/selinux, which obviously wouldn't work without the accompanying .so file.

Also, it looks like any library that installs to /lib will also put their python stuff in /lib/python2.5. I don't know if python even knows to look there, and even if it does there is really no reason to put them there. libselinux.so and libsepol.so will need to go to /lib but the python stuff should go to /usr/lib and I don't see a different argument for the python stuff (only --libdir).

--
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 9 lines · Joshua Brindle
Quoted 3 lines · Vikram Noel Ambrose

Here's the fix to that libselinux ld error you were getting.

Ok, applied and built fine. One interesting thing is that even without building the swig wrappers (--disable-swig) it still installs lib/python2.5/site-packages/selinux, which obviously wouldn't work without the accompanying .so file.

I'll have a look at that, thanks.

Quoted 4 lines

Also, it looks like any library that installs to /lib will also put their python stuff in /lib/python2.5. I don't know if python even knows to look there, and even if it does there is really no reason to put them there. libselinux.so and libsepol.so will need to go to /lib but the python stuff should go to /usr/lib and I don't see a different argument for the python stuff (only --libdir).

Here you are referring to libpy*.so? if so then, Yes, python does know to look for it in its site-packages/$pkg/ folder.

And in regards to the AUTHORS file, it obviously would be in source control and as the persons in question patch the tree, they could obviously patch the file with their names as well, its not set in stone or anything.

Vikram

--
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 25 lines · Vikram Noel Ambrose
Quoted 12 lines · Joshua Brindle
Quoted 3 lines · Vikram Noel Ambrose

Here's the fix to that libselinux ld error you were getting.

Ok, applied and built fine. One interesting thing is that even without building the swig wrappers (--disable-swig) it still installs lib/python2.5/site-packages/selinux, which obviously wouldn't work without the accompanying .so file.

I'll have a look at that, thanks.

Quoted 9 lines

Also, it looks like any library that installs to /lib will also put their python stuff in /lib/python2.5. I don't know if python even knows to look there, and even if it does there is really no reason to put them there. libselinux.so and libsepol.so will need to go to /lib but the python stuff should go to /usr/lib and I don't see a different argument for the python stuff (only --libdir).

Quoted 3 lines

Here you are referring to libpy*.so? if so then, Yes, python does know to look for it in its site-packages/$pkg/ folder.

I know that, I mean no python .so files or .py files are put in /lib/python2.5, they are all put in /usr/lib/python2.5. However, since libselinux.so and libsepol.so (the real libs) have to be in /lib/ there is no way to tell configure to split those up (since they both use libdir)

Quoted 10 lines

And in regards to the AUTHORS file, it obviously would be in source control and as the persons in question patch the tree, they could obviously patch the file with their names as well, its not set in stone or anything.

Vikram

--
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.

#4 lore raw
Quoted 24 lines · Joshua Brindle
Quoted 23 lines · Vikram Noel Ambrose
Quoted 11 lines · Joshua Brindle
Quoted 3 lines · Vikram Noel Ambrose

Here's the fix to that libselinux ld error you were getting.

Ok, applied and built fine. One interesting thing is that even without building the swig wrappers (--disable-swig) it still installs lib/python2.5/site-packages/selinux, which obviously wouldn't work without the accompanying .so file.

I'll have a look at that, thanks.

Quoted 9 lines

Also, it looks like any library that installs to /lib will also put their python stuff in /lib/python2.5. I don't know if python even knows to look there, and even if it does there is really no reason to put them there. libselinux.so and libsepol.so will need to go to /lib but the python stuff should go to /usr/lib and I don't see a different argument for the python stuff (only --libdir).

Quoted 6 lines
Quoted 3 lines

Here you are referring to libpy*.so? if so then, Yes, python does know to look for it in its site-packages/$pkg/ folder.

I know that, I mean no python .so files or .py files are put in /lib/python2.5, they are all put in /usr/lib/python2.5. However, since libselinux.so and libsepol.so (the real libs) have to be in /lib/ there is no way to tell configure to split those up (since they both use libdir)

Ping?

--
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.

#5 lore raw
Quoted 37 lines · Joshua Brindle
Quoted 35 lines · Joshua Brindle
Quoted 33 lines · Vikram Noel Ambrose
Quoted 14 lines · Joshua Brindle
Quoted 4 lines · Vikram Noel Ambrose

Here's the fix to that libselinux ld error you were getting.

Ok, applied and built fine. One interesting thing is that even without building the swig wrappers (--disable-swig) it still installs lib/python2.5/site-packages/selinux, which obviously wouldn't work without the accompanying .so file.

I'll have a look at that, thanks.

Quoted 10 lines

Also, it looks like any library that installs to /lib will also put their python stuff in /lib/python2.5. I don't know if python even knows to look there, and even if it does there is really no reason to put them there. libselinux.so and libsepol.so will need to go to /lib but the python stuff should go to /usr/lib and I don't see a different argument for the python stuff (only --libdir).

Here you are referring to libpy*.so? if so then, Yes, python does know to look for it in its site-packages/$pkg/ folder.

Quoted 7 lines
Quoted 3 lines

I know that, I mean no python .so files or .py files are put in /lib/python2.5, they are all put in /usr/lib/python2.5. However, since libselinux.so and libsepol.so (the real libs) have to be in /lib/ there is no way to tell configure to split those up (since they both use libdir)

Ping?

Sorry for the radio silence, been tied up of late.

I *think* I understand the problem,

Using the attached patch, python site packages folder resolution is done as follows:

1. Try get python-site folder by asking "python"
--- This only really works if HOST machine = BUILD machine, and
if the host's python was not relocated at installation.

2. User supplies --with-python-site=/some/where/python2.4/site-packages

So either way, the site-packages folder can be specified.

This patch also:

1. Stops the swig interface from being rebuilt when python headers are not found, even if swig is found. This is done because the interface is not going to be built without the headers, so no point on rebuilding it's source.

2. Prevents selinux/__init__.py from being installed, if the libpyselinux.so wrapper cannot be built. Done because the python module is useless without the wrapper.

3. A little bit of white space clean up and formatting.

If i've understood the problem correctly, then i'll patch the others (libsemanage etc..)

thanks josh,

Vikram

libselinux/configure.ac +23 -11
index 5d97078..a437404 100644
@@ -92,15 +92,18 @@ AM_CONDITIONAL([enable_avc], [ test "$_enable_avc" = yes])
 AM_CONDITIONAL([enable_bool], [ test "$_enable_bool" = yes])
 AM_CONDITIONAL([enable_docs], [ test "$_enable_docs" = yes])
 
-AC_ARG_WITH([pythonver],
-	[AC_HELP_STRING([--with-pythonver=x],[Python version (eg 2.4) ])],
-        [],
-        [with_pythonver=$PYTHON_VERSION]
+AC_ARG_WITH([python-site],
+	[AC_HELP_STRING([--with-python-site=PATH],
+			[Optional path to python site-packages folder,
+			eg /usr/lib/python2.4/site-packages])],
+	[]
 )
 
-if test -n "$with_pythonver" ; then
-        AC_SUBST([pythondir],[$libdir/python$with_pythonver/site-packages])
-        AC_SUBST([pyexecdir],[$libdir/python$with_pythonver/site-packages])
+if test -n "$with_python_site" ; then
+	AC_SUBST([pythondir],[$with_python_site])
+	AC_SUBST([pyexecdir],[$with_python_site])
+else
+	AC_MSG_WARN([Python site folder not specified, guessing...])
 fi
 
 AC_ARG_WITH([python],
@@ -138,7 +141,7 @@ AC_ARG_WITH([static-libsepol],
         else
                 AC_MSG_RESULT([no found])
                 AC_MSG_WARN([[Cannot build libpyaudit2why.so python wrappper. 
-			Try --with-static-libsepol=PATH]])
+		Try --with-static-libsepol=PATH]])
 
         fi],
         [AC_MSG_CHECKING([for libsepol.a in $prefix/lib])]
@@ -148,7 +151,7 @@ AC_ARG_WITH([static-libsepol],
         else
                 AC_MSG_RESULT([not found])
                 AC_MSG_WARN([[Cannot build libpyaudit2why.so python wrappper. 
-			Try --with-static-libsepol=PATH]])
+		Try --with-static-libsepol=PATH]])
         fi]
 )
 
@@ -177,6 +180,14 @@ if test "$_enable_swig" = "yes" -a -z "$SWIG" ; then
 		or install swig])
 fi
 
+# If libpy*.so wrapper cannot be built, then do not rebuild swig interface
+# even if swig is available, and do not install selinux/__init__.py
+if test "$have_python" != "yes" ; then
+	_enable_swig=no
+	AC_MSG_NOTICE([Swig interface does not need to be regenerated 
+		because libpyselinux.so wrapper cannot be built])
+fi
+
 # slip in fake swig if needed
 if test "$_enable_swig" != "yes" ; then
 	AC_SUBST([SWIG],[/bin/true])
@@ -201,10 +212,12 @@ $PRINT "\n*** Libselinux Configuration summary ***\n"
 if test "$have_python" != yes ; then
  $PRINT "\taudit2why\t\t= no "
  $PRINT "(try --with-python=/usr/include/python$PYTHON_VERSION) \n"
- $PRINT "\tlibpyselinux.so\t\t= no\n"
+ $PRINT "\tlibpyselinux.so\t\t= no "
+ $PRINT "(try --with-python=/usr/include/python$PYTHON_VERSION) \n"
 else
  $PRINT "\taudit2why\t\t= yes (Using python headers $with_python) \n"
  $PRINT "\tlibpyselinux.so\t\t= yes\n"
+ $PRINT "\tPython site folder\t= $pythondir\n"
 fi
 
 if test -n "$LIBSEPOL_A_PATH" ; then
@@ -221,5 +234,4 @@ $PRINT "\tSELinux utlities\t= yes\n"
 $PRINT "\tInstall Man pages\t= $_enable_docs\n"
 $PRINT "\tSELinux Type\t\t= $with_policyname\n"
 $PRINT "\tRegenerate py wrapper\t= $_enable_swig\n"
-$PRINT "\tPython Packages folder\t= $pythondir\n"
 $PRINT "------------------------------------------------------------\n" 
libselinux/src/Makefile.am +3 -1
index fd22726..a32f4a9 100644
@@ -30,7 +30,7 @@ lib_LTLIBRARIES			= libselinux.la
 selinux_pyexecdir		= $(pyexecdir)/selinux
 selinux_pythondir		= $(pythondir)/selinux
 selinux_pyexec_LTLIBRARIES	= $(extra_lib)
-selinux_python_PYTHON		= __init__.py
+selinux_python_PYTHON		= $(extra_py) 
 
 sysconf_DATA			= config
 config:Makefile
@@ -38,12 +38,14 @@ config:Makefile
 		
 PACKAGE				= selinux
 extra_lib			=
+extra_py			=
 libselinux_la_SOURCES		= $(BUILDSRC)
 libselinux_la_LDFLAGS		= -Wl,--as-needed -version-info 1
 if enable_python
 selinuxswig_wrap.c: Makefile selinuxswig.i selinuxswig_python.i
 	$(SWIG) -o $@ $(SWIG_FLAGS) -interface libpyselinux $(srcdir)/selinuxswig_python.i 
 extra_lib			+= libpyselinux.la
+extra_py			+= __init__.py
 libpyselinux_la_SOURCES		= selinuxswig_wrap.c
 libpyselinux_la_CPPFLAGS	= \
 	-I@PYTHON_INCLUDE_DIR@