arm-none-eabi-gdb python fatal error (Ubuntu 22.04)

696 Views Asked by At

in my Ubuntu 22.04, I wanted to open a GDB client to connect to openocd. So I used arm-none-eabi-gdb, however I received the following error

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f1c996e7c00 (most recent call first):
<no Python frame>

Previously the PYTHONPATH was set to a ros humble directory but I've removed ros humble completely (just now), that's why it became not set.

For the PYTHOMHOME, it wasn't set from the start.

I've also tried reinstalling my python. I installed python 3.11.4 (previous version was 3.10.2)

To what path should I set the PYTHONHOME and PYTHONPATH into? Moreover is there anything more that I should configure?

1

There are 1 best solutions below

3
Ali On

Ubuntu 22.04 comes with Python 3.10, but arm-none-eabi-gdb needs Python 3.8.

Changing to gdb-multiarch was the solution for me.