ubuntuarmcross-compiling

How to install "gcc-arm-linux-gnueabihf" specific version?


Am performing cross compilation on x86 and target platform is armhf. When i run command apt-get install -y gcc-arm-linux* g++-arm-linux*, It installs 4.11.2.0 version and output is as below

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)

But i need 4.9.3.0 version. How to install 4.9.3.0 version in ubuntu command line??

Am using ubuntu 20.04 and performing cross compilation using focal apt list

my /etc/apt.source.list file is as below

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

Solution

  • As pointed-out by old_timer, you could download/use a pre-built toolchain. You could for example use the arm-linux-gnueabihf-gcc provided in release 15.02 of the Linaro toolchains - tested on Ubuntu 22.04 and 24.04:

    Downloading/installing:

    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
    

    Verifying gcc version:

    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.