如何安装“gcc-arm-linux-gnueabihf”特定版本?

如何安装“gcc-arm-linux-gnueabihf”特定版本?

我在 x86 上执行交叉编译,目标平台是 armhf。当我运行命令时 apt-get install -y gcc-arm-linux* g++-arm-linux*,它会安装4.11.2.0版本和输出如下

g++-arm-linux-gnueabi is already the newest version (4:11.2.0-1ubuntu1). 
g++-arm-linux-gnueabihf is already the newest version (4:11.2.0-1ubuntu1).    
gcc-arm-linux-gnueabi is already the newest version (4:11.2.0-1ubuntu1).    
gcc-arm-linux-gnueabihf is already the newest version (4:11.2.0-1ubuntu1)

但是我需要4.9.3.0版本。如何在 ubuntu 命令行中安装 4.9.3.0 版本??

我正在使用 ubuntu 20.04 并使用焦点 apt 列表执行交叉编译

我的 /etc/apt.source.list 文件如下

echo "### Copying ARM sources to /etc/apt/sources.list ###"
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe" >  /etc/apt/sources.list
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports focal main universe" >>  /etc/apt/sources.list
echo "deb-src http://archive.ubuntu.com/ubuntu focal main universe" >>  /etc/apt/sources.list

输出apt policy gcc-arm-linux-gnueabihf

gcc-arm-linux-gnueabihf:
  Installed: 4:11.2.0-1ubuntu1
  Candidate: 4:11.2.0-1ubuntu1
  Version table:
 *** 4:11.2.0-1ubuntu1 100
        100 /var/lib/dpkg/status
     4:9.3.0-1ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

答案1

您可以强制使用一个版本:

apt-get install gcc-arm-linux-gnueabihf=4:9.3.0-1ubuntu2

man apt-getinstall pkg [{=pkg_version_number | /target_release}]...

相关内容