Unable to compile AppArmor Python bindings with Python 3.10
I am unable to compile the Python bindings for AppArmor with the latest version of Python, Python 3.10. Tested with the latest AppArmor sources from git. Worked without issues on Python 3.9 and earlier.
Here are the steps I took to build:
git clone https://gitlab.com/apparmor/apparmor.git
cd apparmor/libraries/libapparmor
./autogen.sh
./configure --prefix=/usr --with-perl --with-python
Configure output:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for flex... flex
checking for lex output file root... lex.yy
checking for lex library... none needed
checking for library containing yywrap... no
checking whether yytext is a pointer... yes
checking for bison... bison -y
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for swig... /usr/bin/swig
checking whether the libapparmor debug output should be enabled... no
checking whether the libapparmor man pages should be generated... yes
checking for podchecker... podchecker
checking for pod2man... pod2man
checking whether python bindings are enabled... yes
checking for python3... /usr/bin/python3
checking for python... (cached) /usr/bin/python3
checking for python3-config... /usr/bin/python3-config
checking for a version of Python >= '2.1.0'... yes
checking for the distutils Python package... no
configure: error: cannot import Python module "distutils".
Please check your Python installation. The error was:
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
Output of python3 --version
:
Python 3.10.0