Easy Install gcc Cross Compiler: Difference between revisions

From Ariaboard Wiki
Jump to navigation Jump to search
(Created page with "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 u...")
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 7: Line 7:
To understand what a cross compiler is, plz read http://en.wikipedia.org/wiki/Cross_compiler
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 2013.04 Linaro gcc==
==Installation==


===Linaro gcc at launchpad.net:===
Toolchain Home Page: https://launchpad.net/linaro-toolchain-binaries/


===prerequisites===
===prerequisites ubuntu 14.04===
sudo apt-get -y install libgphoto2-2:i386 libsane:i386 libgd2-xpm:i386 ia32-libs-multiarch uboot-mkimage lzop
  sudo apt-get -y install bc build-essential device-tree-compiler lsb-release lzma lzop fakeroot ccache libc6-i386 libstdc++6:i386
  sudo apt-get -y install bc build-essential device-tree-compiler lsb-release lzma lzop fakeroot u-boot-tools ia32-libs ccache ia32-libs lzop




===actual install===
 
 
===prerequisites ubuntu ubuntu 16.04===
sudo apt-get -y install bc build-essential device-tree-compiler lsb-release lzma lzop fakeroot ccache libc6-i386 libstdc++6:i386 u-boot-tools  module-init-tools
 
if there is a problem with: kernel/timeconst.pl, please change line 373:
 
if (!defined(@val)) {
 
to
 
if (!@val) {
 
https://freetz.org/ticket/2759
 
 
===armhf toolchian install (both 14.04 and 16.04)===
  cd /opt
  cd /opt
  sudo wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.04/+download/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.xz
  sudo wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz
  sudo tar xvfJ gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.xz
  sudo tar -xvf gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz
  echo "PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin:${PATH}" >> ~/.bashrc
  echo "PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin:${PATH}" >> ~/.bashrc
 


=== On old ubuntu system (with apt install)===
sudo apt-get install gcc-arm-linux-gnueabihf


===test installation===
==test installation==
re-login your console and test with:
re-login your console and test with:
  root@avernus:~# arm-linux-gnueabihf-gcc
  root@avernus:~# arm-linux-gnueabihf-gcc
Line 34: Line 52:




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


~# arm-linux-gnueabihf-gcc
==gcc 5==
zsh: no such file or directory: arm-linux-gnueabihf-gcc
Later kernel requires later version of gcc. please download Linaro gcc binaries:


==Actuall Path Installed at==
  wget http://releases.linaro.org/components/toolchain/binaries/5.4-2017.01/arm-linux-gnueabihf/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf.tar.xz
  /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

Latest revision as of 14:08, 17 April 2017

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


Installation

Linaro gcc at launchpad.net:

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

prerequisites ubuntu 14.04

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



prerequisites ubuntu ubuntu 16.04

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

if there is a problem with: kernel/timeconst.pl, please change line 373:

if (!defined(@val)) { 

to

if (!@val) { 

https://freetz.org/ticket/2759


armhf toolchian install (both 14.04 and 16.04)

cd /opt
sudo wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz
sudo tar -xvf gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz
echo "PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin:${PATH}" >> ~/.bashrc


On old ubuntu system (with apt install)

sudo 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!


gcc 5

Later kernel requires later version of gcc. please download Linaro gcc binaries:

wget http://releases.linaro.org/components/toolchain/binaries/5.4-2017.01/arm-linux-gnueabihf/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf.tar.xz