Easy Install gcc Cross Compiler: Difference between revisions

From Ariaboard Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:


===prerequisites===
===prerequisites===
  sudo apt-get -y install bc build-essential device-tree-compiler lsb-release lzma lzop fakeroot ccache libc6-i386
  sudo apt-get -y install bc build-essential device-tree-compiler lsb-release lzma lzop fakeroot ccache libc6-i386 libstdc++6:i386
 





Revision as of 04:02, 20 November 2015

We are using Linaro gcc armhf cross compiler, getting the binaries of gcc from the official or trusted source is preferred.


Why Cross Compiling

Cross compiler enables us to compile ARM code on x64/x86 machines with 10 times plus speed. we will use it for Kernel, U-Boot, and other compilation.

To understand what a cross compiler is, plz read http://en.wikipedia.org/wiki/Cross_compiler

Linaro gcc at launchpad.net:

Home Page: https://launchpad.net/linaro-toolchain-binaries/

Simple Install Linaro gcc on ubuntu 14.04

prerequisites

sudo apt-get -y install bc build-essential device-tree-compiler lsb-release lzma lzop fakeroot ccache libc6-i386 libstdc++6:i386


actual install

cd /opt
sudo wget http://releases.linaro.org/14.04/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz
sudo tar xvfJ gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz
echo "PATH=/opt/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz/bin:${PATH}" >> ~/.bashrc


Or install with ubuntu system

apt-get install gcc-arm-linux-gnueabihf

test installation

re-login your console and test with:

root@avernus:~# arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-gcc: fatal error: no input files
compilation terminated.

yeh! it works!


faq

请注意:这个工具包是32位程序,在某些不兼容32位程序的64位linux系统中会报如下错误

~# arm-linux-gnueabihf-gcc
zsh: no such file or directory: arm-linux-gnueabihf-gcc

Actuall Path Installed at

/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/arm-linux-gnueabihf/bin
/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin