如何在 Ubuntu 20.04 LTS(Focal Fossa)上安装 arm-none-eabi-gdb

如何在 Ubuntu 20.04 LTS(Focal Fossa)上安装 arm-none-eabi-gdb

我尝试安装 arm-none-eabi-gdb 作为 gcc-arm-embedded 的一部分。我添加了 PPA:

sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa

并执行:

sudo apt install gcc-arm-embedded 

它回应道:

Err:8 http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu focal Release
  404  Not Found [IP: 91.189.95.83 80]

据我所知 - gcc-arm-embedded 没有适用于 Ubuntu 20 的版本。因此,我已将此 PPA 的发布版本更改为软件与更新到 bionic 这样我就可以避免错误 404。

尽管 ubuntu 20 有 libisl22,但当我尝试安装 gcc-arm-embedded 时,仍然有未满足的依赖项:

The following packages have unmet dependencies:
 gcc-arm-embedded : Depends: libisl15 (>= 0.15) but it is not installable
E: Unable to correct problems, you have held broken packages.

我无法找到安装所需版本 libisl 的方法,因为 apt 仅提供两个版本 - libisl22 和 libisl-dev,并且安装程序均不接受这两个版本。

我需要有关如何安装 arm-none-eabi-gdb 的建议。谢谢!

答案1

事实证明,ARM 决定通过弃用 PPA 来让我们的生活更轻松(讽刺)——他们的启动板页面现在有一个公告:“... 今后所有新的二进制和源包将不会在 Launchpad 上发布...”。

因此,要使用其最新的 arm-none-eabi-gdb,您必须手动安装 gcc-arm-embedded。

从系统中删除 arm-none-eabi-gcc:

sudo apt remove gcc-arm-none-eabi

下载最新版本(Linux x86_64 Tarball)从他们的网站,检查其 MD5。将其解压到某个目录中。我使用了 /usr/share/ :

sudo tar xjf gcc-arm-none-eabi-YOUR-VERSION.bz2 -C /usr/share/

创建链接以便二进制文件可在整个系统范围内访问:

sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-gcc /usr/bin/arm-none-eabi-gcc 
sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-g++ /usr/bin/arm-none-eabi-g++
sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-gdb /usr/bin/arm-none-eabi-gdb
sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-size /usr/bin/arm-none-eabi-size
sudo ln -s /usr/share/gcc-arm-none-eabi-YOUR-VERSION/bin/arm-none-eabi-objcopy /usr/bin/arm-none-eabi-objcopy

安装依赖项。readme.txt 中列出的 ARM 的“完整安装说明”不会告诉您依赖项是什么 - 您必须通过反复试验来弄清楚。在我的系统中,我必须手动创建符号链接才能强制它工作:

sudo apt install libncurses-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libncurses.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5
sudo ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5

检查是否有效:

arm-none-eabi-gcc --version
arm-none-eabi-g++ --version
arm-none-eabi-gdb --version
arm-none-eabi-size --version

答案2

我已经把剧本包装好了来自@kmhallen进入半自动化的 Debian 软件包构建器:https://gitlab.com/alelec/arm-none-eabi-gcc-deb/-/releases

安装这样的包意味着您可以跳过繁琐的手动符号链接来将工具放在路径上,同样重要的是您可以卸载/升级到较新的包(假设我记得制作更多包)

答案3

该工具链现在仅在其网站上提供: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

解压后将文件夹路径添加bin到系统路径中:

cd /opt
wget "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2"
tar -jxf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
rm gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
export PATH="/opt/gcc-arm-none-eabi-10.3-2021.10/bin:$PATH"

或者,这里有一个脚本可以生成 Debian 包并将其安装到目录中/usr。这样你就不必一直导出路径,并且可以用以下命令将其删除sudo apt purge gcc-arm-none-eabi

#!/bin/bash

VER=15:10.3-2021.10-9
URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
echo "Creating gcc-arm-none-eabi debian package version $VER"

echo "Entering temporary directory..."
cd /tmp

echo "Downloading..."
curl -fSL -A "Mozilla/4.0" -o gcc-arm-none-eabi.tar "$URL"

echo "Extracting..."
tar -xf gcc-arm-none-eabi.tar
rm gcc-arm-none-eabi.tar

echo "Generating debian package..."
mkdir gcc-arm-none-eabi
mkdir gcc-arm-none-eabi/DEBIAN
mkdir gcc-arm-none-eabi/usr
echo "Package: gcc-arm-none-eabi"          >  gcc-arm-none-eabi/DEBIAN/control
echo "Version: $VER"                       >> gcc-arm-none-eabi/DEBIAN/control
echo "Architecture: amd64"                 >> gcc-arm-none-eabi/DEBIAN/control
echo "Maintainer: maintainer"              >> gcc-arm-none-eabi/DEBIAN/control
echo "Description: Arm Embedded toolchain" >> gcc-arm-none-eabi/DEBIAN/control
mv gcc-arm-none-eabi-*/* gcc-arm-none-eabi/usr/
dpkg-deb --build --root-owner-group gcc-arm-none-eabi

echo "Installing..."
sudo apt install ./gcc-arm-none-eabi.deb -y --allow-downgrades

echo "Removing temporary files..."
rm -r gcc-arm-none-eabi*

echo "Done."

检查是否有效:

arm-none-eabi-gcc --version

答案4

Aleksander 的回答解决了我 99% 的问题,但在运行 make 后,我收到一个错误 arm-none-eabi-objcopy:未找到命令。因此,我不得不再创建一个符号链接来生成文件。

sudo ln -s /usr/share/gcc-arm-none-eabi-你的版本/bin/arm-none-eabi-objcopy /usr/bin/arm-none-eabi-objcopy

我尝试将其作为评论添加到答案中,但我没有足够的积分来做到这一点。

相关内容