Skip to content
This repository has been archived by the owner on Jun 18, 2018. It is now read-only.

SETools 4 on Ubuntu 16.10

Antony Cherepanov edited this page Jan 13, 2017 · 1 revision

This doc describes how to install setools 4 on Ubuntu 16.10 (x64) with Python 2.7.

Related issue: Issue 162

1. Install Ubuntu and Python packages

$ sudo apt install gcc bison flex swig mock libbz2-dev
$ sudo apt install libsepol1 libsepol1-dev gcc sepol-utils
$ sudo apt install libselinux1 libselinux1-dev python-selinux selinux-utils python-dev
$ sudo apt install python-enum34 python-pyqt5 python-setools python-pip python-mock python-tox
$ sudo pip install networkx

2. Modify setup.py

Open setup.py. Add path /usr/lib/x86_64-linux-gnu to base_lib_dirs variable:

 base_lib_dirs = ['.', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']

Add -Wno-sign-compare to the extra_compile_args variable:

extra_compile_args=['-Werror',
                    '-Wextra',
                    '-Waggregate-return',
                    '-Wcast-align',
                    '-Wfloat-equal',
                    '-Wformat', '-Wformat=2',
                    '-Winit-self', '-Winline',
                    '-Wmissing-format-attribute',
                    '-Wmissing-include-dirs',
                    '-Wnested-externs',
                    '-Wold-style-definition',
                    '-Wpointer-arith',
                    '-Wredundant-decls',
                    '-Wstrict-prototypes',
                    '-Wunknown-pragmas',
                    '-Wwrite-strings',
                    '-Wno-missing-field-initializers', # SWIG 3.0.2 generates partially-initialized structs
                    '-Wno-unused-parameter', # SWIG generates functions with unused parameters
                    '-Wno-cast-qual', # libsepol uses const-to-nonconst casts
                    '-Wno-shadow', # SWIG generates shadow variables
                    '-Wno-unreachable-code', # Bison generates unreachable code
                    '-Wno-sign-compare', # libqpol generates integer comparison error
                    '-fno-exceptions'],
                         swig_opts=['-Ilibqpol/include'],
                         define_macros=macros,
                         extra_objects=[static_sepol])]

3. Build and install

$ python setup.py build
$ sudo python setup.py install