1

I'm trying to use arm-none-eabi-gdb as the debugger for my stm32 project, but when I try to execute it, it return 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>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f75639ddc00 (most recent call first):
Aborted (core dumped)

I look online and find this solution, but when I enter export PYTHONHOME=/usr/local it come out annother error message that I cannot find any solution:

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fcc24680c00 (most recent call first):
Aborted (core dumped)

I've check that my python and python3 work ok, Is there anything I should check for?

Thank you ~

The arm gcc_tool_chain version I'm using is 11.2-2022.02 for x86_64 Linux hosted which I download from the official website. And After downloading it, I just unzip it and add the toolchain directory into $PATH. I did not compile or install and I'm not sure if I should do any of those since I download the binary version(gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz) and the arm-none-eabi-g++ compiler works perpectly.

Benycu
  • 11
  • 3
  • you could try doing `pip install encodings` or the equivalent. it looks like python is trying to load that and its not available. – Russ Schultz May 10 '22 at 19:46
  • @RussSchultz I tried, but it cannot find that module: `ERROR: Could not find a version that satisfies the requirement encodings (from versions: none) ERROR: No matching distribution found for encodings'` – Benycu May 11 '22 at 12:02
  • @Benycu Could you please augment your question with the exact distribution of Linux and version of Python3 you are using for your development ? – Frant May 12 '22 at 11:08
  • @Frant Thank you replying ~~ Sorry I waited so long to reply. After multiple time of trying, I decided to reinstall the entire OS. But I still cannot run it. Then I try to install from source and it work!! Although the install-from-source compiler is lack of nano library, I thought it is enough for me. But for future references, the OS i'm using is Ubuntu 20.04 and the python version I have are python2.7, python3.6, and python3.8. – Benycu May 13 '22 at 18:53

2 Answers2

0

I think you truncated the message you received! I had same problem. arm-none-eabi-gdb looks for specific python version that explained at end of the message! Mine was 3.8 whereas I already had 3.10. so I decided to install python 3.8 in parallel with my installed version. After some search I found a way:

sudo add-apt-repository ppa:deadsnakes/ppa
apt update
sudo apt install python3.8

You can find more information in this site.

  • I can confirm this worked, but i had to edit ppa after adding as i have newer OS which is not supported. So edit target to jammy worked also on newer ubuntu 22.10 – Hadatko Dec 07 '22 at 18:46
  • 1
    correct ppa: `sudo add-apt-repository ppa:deadsnakes/ppa` – Hadatko Dec 07 '22 at 18:53
0

It is weird that on my machine with python3.10 and kubuntu 22.10 it is working with gdb from 10.3. But 11.3 is complaining

Hadatko
  • 89
  • 3