Stayton Board

Compiling Programs for Stayton

  • Download and unpack the i386-linux to arm-linux cross compiler
  • Make sure that /usr/local/arm/bin is in your path
  • To compile your own source or other simple projects, use the compiler, arm-linux-gcc
  • For bigger projects that you download, generally the process is
    ./configure
    make
    make install
    You should read and see if the program provides cross compilation instructions. There are some general steps to try.
  • There are 3 configure options that govern cross-compilation.
    --built
    The system type you are building on, right now, probably i386-linux
    --target
    The system type that the program is meant for, in this case arm-linux
    --host
    The system type that the program will run on. This may seem confusing, as it appears to be the same thing as --target. In most cases it is (and in most cases the default for --host is the value of --target), but imagine using an i386-linux machine to compile a cross compiler from ia64-linux (host) to arm-linux (target). I don't know why you'd do that but now you understand.
  • Usually you can try ./configure --target=arm-linux. Some programs seem to want --host set rather than --target. Other programs require setting --build=i386-linux though most will autodetect that. You shouldn't be able to go wrong specifying ./configure --build=i386-linux --target=arm-linux --host==arm-linux
  • Grab the first 2 dozen or so lines of the output, and check to make sure it worked. Look for line that says "checking for gcc... ". It should say arm-linux-gcc after that, not gcc. A couple lines down from that look for "checking whether we are cross compiling... yes".
  • If it still doesn't work, the program's configure script might not be set up to cross compile correctly. Most of these configure scripts are generated with autoconf. It is possible it was built with a too old version of autoconf that didn't handle cross-compiling as well as newer ones. Most source packages will include the autoconf files, so if you have a recent autoconf installed on your machine, try running autoconf to regenerate the configure script.
  • If all that fails, then you can cheat. Packaged with the cross-compiler is /usr/local/arm/arm-linux/bin. This directory contains links to all the arm-linux-gcc, arm-linux-... tools but under their normal names (gcc, etc). Try putting this at the head of your path to force programs that insist on using gcc to cross-compile.
  • I had a problem once where the compiler generated a program that was dependant on some library I didn't have or something like that. Reading up on the web, told me it was a new thing with gcc-3.2, so to get around it I used the 2.95.3 cross compiler
  • There are lots more intricacies, problems, and solutions. Cross compiling anything significate takes some skill, practice, and enginuity. Good luck.