Unfortunately some time ago ARM decided to deprecate the use of PPA so to use their latest arm-none-eabi-gdb you have to install gcc-arm-embedded manually. But don’t worry, in this article I will guide you through this process step by step so it would be very easy.
STEP 1: Removing current arm-none-eabi-gcc
If you already have arm-none-eabi-gcc installed on your system please remove it
sudo apt remove gcc-arm-none-eabi
STEP 2: Download latest version linux x86_64 tarball archive
Go to arm developer portal download page and searche for x86_64 Linux hosted cross toolchains tarball archive. The link file should be name like this:
arm-gnu-toolchain-<version>-x86_64-arm-none-eabi.tar.xz
The file should have extension .tar or .tar.xz (for the compressed archive)
STEP 3: Unpack downloaded archive
Go to the folder where you downloaded the file and run the command to extract tar.xz. Note that your file will probably have a different name due to version differences, so please update it accordingly.
sudo tar -xJf arm-gnu-toolchain-<version>-x86_64-arm-none-eabi.tar.xz /usr/share/
STEP 4: Creat symbolic links to make binaries accessible system wide
sudo ln -s /usr/share/arm-gnu-toolchain-<version>-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc /usr/bin/arm-none-eabi-gcc
sudo ln -s /usr/share/arm-gnu-toolchain-<version>-x86_64-arm-none-eabi/bin/arm-none-eabi-g++ /usr/bin/arm-none-eabi-g++
sudo ln -s /usr/share/arm-gnu-toolchain-<version>-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb /usr/bin/arm-none-eabi-gdb
sudo ln -s /usr/share/arm-gnu-toolchain-<version>-x86_64-arm-none-eabi/bin/arm-none-eabi-size /usr/bin/arm-none-eabi-size
sudo ln -s /usr/share/arm-gnu-toolchain-<version>-x86_64-arm-none-eabi/bin/arm-none-eabi-objcopy /usr/bin/arm-none-eabi-objcopy
STEP 5: Check if arm-none-eabi programs works
arm-none-eabi-gcc --version
arm-none-eabi-g++ --version
arm-none-eabi-gdb --version
arm-none-eabi-size --version
arm-none-eabi-objcopy --version
Troubleshooting
When checking version with above command, you didn’t received output similar to this, it means that some additional steps are needed.
One of the common problem might be missing libncursesw library. In this case you should recive output similar to this:
arm-none-eabi-gdby: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory
The solution for that is running following command to see if the library is installed
ldconfig -p | grep libncursesw
If it return no result, the library is missing so you need to install it:
sudo apt update
sudo apt install libncurses5
If you see something like libncursesw.so.6 instead of libncursesw.so.5 you likely have a newer version, but arm-none-eabi-gdb is looking for the older one. Solution in this case is creating symlink between them. At first you need to find the location of the library
find /usr/lib /lib -name "libncursesw.so"
Use the output to create symbolick link
sudo ln -s /lib/x86_64-linux-gnu/libncursesw.so.6 /lib/x86_64-linux-gnu/ libncursesw.so.5
If you still can’t find or install libncursesw.so.5 from your system’s repository, you can manually download it
- Download the library: search for a „libncurses5” package compatible with you system on Ubuntu Packages or similar repositories
- Install it manually:
dpkg -i libncurses5*.deb