After updating the Linux OS of a system from 32bit to 64bit OS. After which the ARM cross compiler failed to work.

The error message was No such file or directory, which looks strange also misleading.

$ ./arm-linux-gnueabihf-gcc
bash: ./arm-linux-gnueabihf-gcc: No such file or directory

So I tried to exectue the command with absolute path.

$ /opt/arm-tools/gcc-none-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc
bash: /opt/arm-tools/gcc-none-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc: No such file or directory

I tried lots of thing, permissions, path setup, and soon.

Nothing worked

While troubleshooting I just found the binary was compiled for 32bit system, Wow that was the clue.

$ file /opt/arm-tools/gcc-none-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc-4.8.3 /opt/arm-tools/gcc-none-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc-4.8.3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, stripped

But system OS was pure 64bit installation.

$ uname -a
Linux onion 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux

From my experience of toolchain building task earlier, I knew this was due to Multilib. I need to install Multilib package to support executing of 32bit binaries.

Solution

Enable i386 package installation support

sudo dpkg --add-architecture i386
sudo apt-get update

Install packages need to build source code on the system

sudo apt-get install git build-essential fakeroot

gcc-multilib is the package which will enable running 32bit (x86) binaries on 64bit (amd64/x86_64) system.

sudo apt-get install gcc-multilib
sudo apt-get install zlib1g:i386

Now lets try it again

$ /opt/arm-tools/gcc-none-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-gcc-4.8.3: fatal error: no input files
compilation terminated.

Now it works.