cross compiler vs. native compiler

plug-discuss@lists.plug.phoenix.az.us plug-discuss@lists.plug.phoenix.az.us
Wed, 20 Mar 2002 13:56:51 -0700


On Wed, Mar 20, 2002 at 01:36:30PM -0700, der.hans wrote:
> Am 20. Mar, 2002 schwätzte Craig S. so:
> 
> > I was reading the 2.4.18 install documentation and am thinking some of
> > my problems are stemming from older versions of gcc and make.
> > While reading the install document for gcc there are two types of
> > compilers discussed, native and cross. I am assuming that the original
> > gcc package that came with slackware 7.1 is setup as a native compiler.
> > Thought I would ask to see if this is correct.
> 
> Yes.

</LURK>

I concur -- Slackware and virtually every other distro ship with native
compilers only.

> It might also be a cross-compiler. Cross-compilers are used to build for a
> hardware architecture other than the one the compiler is running on. For
> instance, the iPAQ has a strongarm processor, but you can use your x86
> desktop to compile programs for the strongarm.

Not likely -- cross compilers for other architectures are typicially given
the name <os>-<cpu>-<program> and usually reside in /usr/<os>-<cpu>/bin. Eg,
for a strongarm gcc built for Linux, the name would be linux-strongarm-gcc.

> I think cross-compiling can be done by just giving some options to the
> normal compiler ( provided it's setup to know how to cross-compile ). I
> think that's what I did for the PPC a couple of years ago. Maybe we'll get
> lucky and one of the guys who really knows this stuff will pipe up :).

The only way I know of being able to compile for both my native architecture
and a foriegn one is by installing two different copies of the compiler and
toolchain -- one configured for native builds, and another for foriegn. It
is possible, however, to tell the compiler to build for a different
architecture, as long as that arch is in the same family. Hence why we can
specify the -march=i486 when GCC is compiled to build for the Intel
architecture.

More information may be gleaned from
http://www.armlinux.org/docs/toolchain/toolchHOWTO/x183.html

<LURK> =o)

--
Thomas "Mondoshawan" Tate
mondoshawan@tank.dyndns.org
http://tank.dyndns.org