Created on: 2025-02-04
If you're using STM32 Cube IDE 1.17.0 on Linux Mint 22.1 MATE and encountering issues programming an external board using the ST-LINK debugger, you may have seen an error like the following:
Could not determine GDB version using command: arm-none-eabi-gdb --version
arm-none-eabi-gdb: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
This error arises because STM32 Cube IDE, which integrates tools like arm-none-eabi-gdb, requires specific versions of the libraries, particularly libncurses.so.5 and libtinfo.so.5, which are often unavailable in newer versions of Linux Mint. Here's a step-by-step guide to resolve this issue and get STM32 Cube IDE running smoothly on your system.
When you try to program an external board with the ST-LINK debugger in STM32 Cube IDE, it attempts to run arm-none-eabi-gdb
to communicate with the hardware. However, the IDE fails to recognize the required GDB version, throwing the following errors:
arm-none-eabi-gdb: error while loading shared libraries: libncurses.so.5: version `NCURSES_5.3.20021019' not found (required by arm-none-eabi-gdb)
arm-none-eabi-gdb: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
This is caused by missing or incompatible versions of libncurses and libtinfo. Specifically, STM32 Cube IDE expects libncurses.so.5, but Linux Mint 22.1 (based on Ubuntu 22.04) ships with libncurses.so.6. Additionally, the required libtinfo.so.5 is also not found in the default repositories.
Many users attempt to create symlinks between the libraries:
sudo ln -s /usr/lib/x86_64-linux-gnu/libncurses.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5
However, this approach does not resolve the issue because arm-none-eabi-gdb
specifically looks for version 5 of `libncurses`, which may have different internal symbols compared to version 6. The mismatch in versions causes the tool to fail, as you might see when the version errors pop up for NCURSES_*
symbols.
The correct solution involves adding a legacy Ubuntu 20.04 repository, installing libncurses5 from it, and then removing the repository after installation. This avoids potential issues with future updates and ensures you get the correct version of the necessary libraries.
To get libncurses5, add the Ubuntu 20.04 (Focal Fossa) repository:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ focal main universe"
sudo apt update
Install libncurses5 (and its dependencies, like libtinfo5) from the newly added repository:
sudo apt install libncurses5 libtinfo5
Optionally, if you need 32-bit libraries for compatibility with STM32 Cube IDE, use:
sudo apt install libncurses5:i386 libtinfo5:i386
The above may not be necessary.
Confirm that libncurses5 is installed:
dpkg -l | grep libncurses5
After successfully installing libncurses5, remove the legacy repository to avoid potential conflicts with future updates. This ensures that your system continues to update from the correct Mint repositories:
sudo add-apt-repository --remove "deb http://archive.ubuntu.com/ubuntu/ focal main universe"
sudo apt update
Now that the repository has been removed, you can verify that STM32 Cube IDE works as expected. Restart the IDE and attempt to program your board again via the ST-LINK. The error related to arm-none-eabi-gdb
should now be resolved.
While adding the legacy repository temporarily solves the issue of missing dependencies, it's important to remove the repository after installation for several reasons:
apt
may pull older packages when performing updates or installing new software, which could cause unexpected behavior or stability problems.By removing the repository after installing the necessary packages, you ensure your system remains up-to-date with the latest stable software while still resolving the dependency issue specific to STM32 Cube IDE.
To resolve the GDB version error when programming an external board with STM32 Cube IDE 1.17.0 using ST-LINK on Linux Mint 22.1 MATE, follow the steps outlined above. Adding a legacy repository temporarily allows you to install libncurses5, but it’s crucial to remove the repository afterward to avoid any future conflicts or security risks. By doing this, you ensure that your development environment remains stable and up-to-date.