When python is not available, e.g. in firejail with some profiles
(for security reasons), gdb refuses to run:
zira:~> firejail --allow-debuggers --profile=firefox
zira% gdb
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = '/usr/bin/python'
isolated = 0
environment = 1
user site = 1
safe_path = 0
import site = 1
is in build tree = 0
stdlib dir = '/usr/lib/python3.11'
sys._base_executable = '/usr/bin/python'
sys.base_prefix = '/usr'
sys.base_exec_prefix = '/usr'
sys.platlibdir = 'lib'
sys.executable = '/usr/bin/python'
sys.prefix = '/usr'
sys.exec_prefix = '/usr'
sys.path = [
'/usr/lib/python311.zip',
'/usr/lib/python3.11',
'/usr/lib/python3.11/lib-dynload',
]
Python Exception <class 'ModuleNotFoundError'>: No module named 'encodings'
Python not initialized
zira%
gdb should dynamically consider that python is optional and run
without python support in such a case.
Note that there is no issue with the dynamical linking against the
/usr/lib/x86_64-linux-gnu/libpython3.11.so.1.0 library; it is just
that the /usr/lib/python3.11 directory is not available.