gdb not working on Ubuntu 22.04 is a well known issue.
[This topic](community.arm.com/.../gcc-arm-11-2-2022-02-x86_64-arm-none-eabi-gdb-fails-on-ubuntu) is focused on gcc-arm-11.2-2022.02-x86_64-arm-none-eabi where gdb doesn'tt work for some missing dependencies.
[The solution](https://community.arm.com/support-forums/f/compilers-and-libraries-forum/52805/gcc-arm-11-2-2022-02-x86_64-arm-none-eabi-gdb-fails-on-ubuntu/178088#178088) said that next release would have a better compatiblity with newer Linux distros.
And so I downloaded the new arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.
gdb doesn't work, but now the error message from`gdb --version`is different:
`
```
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 encodingPython runtime state: core initializedModuleNotFoundError: No module named 'encodings'Current thread 0x00007fed232c0c00 (most recent call first):<no Python frame>
This seems related to [this bug](https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/1992947)
Is there any workaround?
For Ubuntu, specifically, do you have python installed? Do you have python alternatives configured? It may be a workaround that will allow gdb to find the python dependencies.
For example (assuming you have /usr/bin/python3.8 and /usr/bin/python3 installed).
--
sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python3.8 1
sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python3 2
sudo update-alternatives --install /usr/local/bin/python python
Then, to select a default python, use the following:
sudo update-alternatives --config python
I downloaded Ubuntu 22.04 Virtualbox VM from [here](https://www.osboxes.org/ubuntu/), and Python 3.10 is installed.
But it seems that the toolchain searches for Python 3.8.
The previous release of the toolchain (gcc-arm-11.2-2022.02-x86_64-arm-none-eabi) searches for Python 3.6, and manually installing and configuring it works as expected.
With this one, installing Python 3.8 (as I did for 3.6) didn't work.
I have tried using Ubuntu 22.04 using docker, and I did not run into this issue.
Could you please confirm whether you have Python 3.8 installed, and where it is installed on your system?
Depending on where Python 3.8 is installed, can you try setting PYTHONHOME to the location where lib/python3.8 is present.
For example, if your system contains /usr/lib/python3.8, then can you please try setting the value of PYTHONHOME to /usr ?
From your earlier example, it seems like /usr/lib/python3.8 is being searched, so it would be good to confirm whether python3.8 is actually installed in that location or somewhere else.
Hello vvinayag
Ubuntu 22.04 comes with Python 3.10 installed, so Python 3.8 is not installed out of the box.
I installed manually Python 3.8 with the Method 2: Install Python 3.8 manually, as described here.
And now
./arm-none-eabi-gdb --version
returns
GNU gdb (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.1.90.20221210-gitCopyright (C) 2022 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.
Other methods to install Python 3.8 don't work for me.
I'm going to verify is everything is ok.
Yes, but there is still problem when load the gdb-script enabled linux kernel,
When I enabled the CONFIG_GDB_SCRIPTS in linux kernel, and load the
symbol there is another problem:
ModuleNotFoundError: No module named 'zlib'