HIP:TS-7000:cross-compiling
Contents
about
This page describes the creation and usage of a toolchain for cross-compiling from a native linux environment to an ARM environment.
Building rdate to run in Technologic System's TS-Linux for ARM is used as an example, but the steps should be applicable to any application.
download, setup, and prepare the toolchain
You can download the cross-compilation toolchain from:
http://www.embeddedarm.com/software/software-arm-linux.php
The various toolchains are near the bottom of the page. Make sure to download the toolchain with the glibc that matches the glibc of whatever environment you want to compile to.
You can find out what verison of glibc is on your computer by running either:
"rpm -q glibc" for Redhat RPM based systems, or:
"ls -al /lib/libc*" for other systems.
Then use tar to unpack the toolchain. Depending on the type of file, you may need to use different commands to unpack it:
"tar -xvvf foo.tar"
"tar -xvzf foo.tar.gz"
"tar --use-compress-program bzip2 -xvf foo.tar.bz2"
The toolchain will come ready to use. Make sure you haven't unpacked it into your home directory, as the configure scripts expect files to be in a specific location, and if the tools are in locations above or below that due to being in a local directory, it will cause errors.
Next, set your path to the gcc that's included in the toolchain, this can be done in either your bash profile or .bashrc.
cross-compilation and migration
Download the code for the program that you want to compile, cd into the directory with the configure script, and run the script with the following command:
"./configure --host=arm-linux --build=arm --enable-static"
Note that you may need to change the --host= parameter depending on what environment you're compiling to.
The final step is to use the "file foo" command to make sure that it's built for the environment you wish to run it on, then copying it over to the environment you want to run it on.
example: rdate
I built rdate on the b1 cluster.earlham.edu
Download rdate from http://linux.softpedia.com/get/System/System-Administration/Openrdate-17664.shtml
Download the toolchain from http://www.embeddedarm.com/linux/ARM.htm
I used the "Linux Crosstool gcc-3.3.4-glibc-2.3.2 - old abi" toolchain. Next, I used scp to bring the two files over to the cluster.
Use the following command to unpack the toolchain: