error cross-compiling to ARM

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Sat Aug 28 17:34:27 UTC 2010


Salim, All,

On Saturday 28 August 2010 12:47:45 Salim Tyrewala wrote:
> I'm new to busybox. I'm having trouble cross-compiling busybox to ARM
> using arm-elf-gcc. It doesn't find some include files byteswap.h for
> instance.

arm-elf-gcc is a bare-emtal toolchain. You won't be able to build busybox
with such a toolchain. A bare-metal system is a system that runs without
any kernel.

You need a toolchain that targets a Linux-based system. Such toolchain will
have a tuple in the form: arm-unknown-linux-gnu, arm-linux-gnu, or even
arm-linux. Which would give a cross compiler named like:
arm-unknown-linux-gnu-gcc, arm-linux-gnu-gcc or arm-linux-gcc.

The 'gnu' in the tuple means that it is based on the GNU C library glibc.

It can happen also that the tuple be something like: arm-unknown-linux-uclibc
to denote that it is based on the uClibc C library instead of glibc.

> I'm not sure what is happening differently when I cross-compile. Why
> isn't the include path include /usr/include where it should find all
> the headers?

Because those headers are not looked for by a cross-toolchain. A cross-
toolchain has its own set of headers. Those headers come from the kernel
and C library used to build the cross-toolchain, and can widely differ
from those used to build your native toolchain (eg. glibc vs. uClibc, or
a different kernel headers version...)

> I think I'm doing something stupid. Please help!

You can use a proper cross-toolchain targetting Linux. There are pre-built
such toolchains available, see for example Tito's suggestion to use
Code Sourcery's. You can even build your own, either manually (which is
very, very, very complex, and which I do not recommend for a beginner).
or using crosstool-NG or buildroot to build your toolchain.

Crosstool-NG will only build the toolchain, while buildroot can also build
a complete system for you, from the toolchain to the kernel, to busybox
to X.

For a newcomer to cross-compilation, I'd recommend either a pre-built
toolchain (eg. Code Sourcery's) or buildroot.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'




More information about the busybox mailing list