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

fkvaft9z  于 2023-01-08  发布在  Linux
关注(0)|答案(1)|浏览(272)

我在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版本?
我正在使用ubuntu20.04并使用focalapt列表执行交叉编译
我的/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
lmyy7pcs

lmyy7pcs1#

正如old_timer所指出的,你可以下载/使用一个预先构建的工具链,例如,你可以使用Linaro工具链的release 15.02中提供的arm-linux-gnueabihf-gcc--在Ubuntu 22.04上测试:
下载/安装:

wget https://releases.linaro.org/archive/15.02/components/toolchain/binaries/arm-linux-gnueabihf/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf.tar.xz
tar Jxf gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf.tar.xz
PATH=$(pwd)/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf/bin

正在验证gcc版本:

arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Linaro GCC 4.9-2015.01-3) 4.9.3 20150113 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

相关问题