Original URL: http://www.cnblogs.com/muyun/p/3370996.html
1. Install ARM-Linux-GCC tool chain
Only needs one command:
Sudo apt-get install gcc-arm-linux-gnueabi
The premise is that your Ubuntu system version is the latest version supported by the official website, if not, please upgrade. Just execute the above command.
Second, use the tool chain
Attention! You cannot use the gcc command to summon it here. Its name is arm-linux-gnueabi-gcc. If Command Not Found appears, please close Terminal and reopen it. If it doesn't work anymore, it becomes a super user and adds it to the PATH.
Tips: View the installation location.
First of all, you need to obtain the super user permission (available command to temporarily obtain permission: sudo -i)
[email protected]: ~ # locate arm-linux-gnueabi-gcc
/ usr / bin / arm-linux-gnueabi-gcc
/usr/bin/arm-linux-gnueabi-gcc-4.6
/usr/share/man/man1/arm-linux-gnueabi-gcc-4.6.1.gz
/usr/share/man/man1/arm-linux-gnueabi-gcc.1.gz
References:
One, from Stackoverflow, about installing ARM toolchain on Ubuntu or Window.
For ARM-Linux application development the preferred choice is a Linux Host (x86) machine with a ARM toolchain installed in it. In Ubuntu Desktop machine you can use the following command to install ARM toolchain:
Translation: For ARM-Linux application development, the best option is an x86 Linux host with the ARM toolchain installed. In the Ubuntu desktop computer, you can use the following command to install the ARM toolchain.
apt-get install gcc-arm-linux-gnueabi
After toolchain installation you can use the following command for cross compilation:
Translation: After installing the toolchain, you need to cross-compile with the following command:
gcc-arm-linux-gnueabi-gcc -o hello hello.c
Using this toolchain you can cross-compile your C program using Standard C library without the need of startup code. Applications can be cross-compiled at your Host Linux (x86) platform and run on Target Linux (ARM) platform.
Windows version of ARM-Linux Toolchain is also available. You can get it from here.
Linaro Developers Wiki-an open organization focused on improving Linux on ARM, will be a good reference for your work.
Translation: Using this toolchain, you can use the C standard library to cross-compile your C program without startup code? Your program can be cross-compiled on your x86 Linux host and run directly on the Linux (ARM) platform. The windows version of the ARM-Linux toolchain is also available, you can get it from here. Linaro Developers Wiki-A development organization dedicated to improving Linux on the ARM platform, which will be a good reference for your work.
Source link: http://stackoverflow.com/questions/14564978/compiling-a-linux-program-for-arm-architecture-running-on-a-host-os
Second, from askUbuntu, an answer about how to install the ARM toolchain on Ubuntu.
..... However, if you're looking for an ARM cross-compiler, there is one pre-packaged in Ubuntu, which may be easier to get running. It's in the gcc-arm-linux-gnueabi package- to install it:
Translation: However, if you are looking for an ARM platform cross compiler, there is a packaged package in Ubuntu, it may be easier to run. It is in the gcc-arm-linux-gnueabi package, you can install it like this:
sudo apt-get install gcc-arm-linux-gnueabi
Source link: http://askubuntu.com/questions/65630/installing-gnu-arm-toolchain
Third, from stackoverflow. About how to use and add to PATH method.
CodeSourcery convention is to use prefix arm-none-linux-gnueabi- for all executables, not gcc-arm-linux-gnueabi that you mention. So, standard name for CodeSourcery gcc would be arm-none-linux-gnueabi-gcc.
After you have installed CodeSourcery G ++, you need to add CodeSourcery directory into your PATH.
Typically, I prefer to install CodeSourcery into directory like / opt / arm-2010q1 or something like that. If you don't know where you have installed it, you can find it using locate arm-none-linux-gnueabi-gcc, however you may need to force to update your locate db using sudo updatedb before locatewill work properly.
After you have identified where your CodeSourcery is installed, add it your PATH by editing ~ / .bashrclike this:
PATH = / opt / arm-2010q1 / bin: $ PATH
Also, it is customary and very convenient to define
CROSS_COMPILE = arm-none-linux-gnueabi-
in your .bashrc, because with CROSS_COMPILE defined, most tools will automatically use proper compiler for ARM compilation without you doing anything.
Source link: http://stackoverflow.com/questions/14180185/gcc-arm-linux-gnueabi-command-not-found
------------progress--------------
Install the cross compiler. Another note: After actual measurement, this compilation chain is not suitable for mini2440. Only the programs compiled by arm-liinux-gcc4.3 from the official CD can run on mini2440.
The helloworld compiled by this compiler always shows unexpected} error on mini2440.
[Switch] Ubuntu install ARM architecture GCC tool chain (ubuntu install ARM toolchain) the simplest way