When do you need a cross compiler?

I'm going to be working on a PC/104 (x86) embedded single board computer for an upcoming project. I'll be running an embedded Linux distribution for the target operating system. I don't want to have to compile on the target, I'd prefer to compile on a host development machine with more horsepower. Under what circumstances is a cross-compiler required? The development host will be running either a standard Linux distribution (probably Mandrake 9) or possibly Cygwin. If the host and target machines are running different versions of the Linux kernel, or libC, is a cross-compiler required? If so can someone point me to some instructions on the web (or elsewhere) on how to go about setting this up?

Thanks alot,

Mark

Reply to
Mark J
Loading thread data ...

Mark J wrote: : I'm going to be working on a PC/104 (x86) embedded single board computer for : an upcoming project. I'll be running an embedded Linux distribution for the : target operating system. I don't want to have to compile on the target, I'd

I have some advice for you, but you didn't leave a valid email address.

ttyl,

--buddy

Reply to
Buddy Smith

Yes, you would normally need a cross compiler in cases like this. Assuming you are using GNU there are lots of people listening to this group who would be able to help you.

Phil Smith, sometimes G8JSL

snipped-for-privacy@nexusrobotics.co.uk

Embedded software, Robotics, CAN and Consultancy.

Reply to
Phil Smith

Under those where an executable made for the build machine won't run on the target, as-is. E.g. if you want to run the compiler on Windows+Cygwin, but the target is an embedded Linux, you need a cross-compiler.

If the target is running a rather complete Linux installation, you might get away using the native GCC to compile for it. If the target doesn't use the same major release of the the GNU libc, forget it. You might get away using a different kernel on the target than on the development machine, but never a different libc.

But even if it would work, it's generally saner to set up a cross-compiler, if only to avoid accidentally linking in libraries that don't exist on the target. Setting up the include and lib directories for the target on the host system may feel awkward at first, but it pays off in the longer term.

For instructions, just have a good look at the GCC and binutils (!) installation instructions --- it's all there.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

Some of the tools used by the Linux kernel build process use mmap() which -I think- is not available in Cygwin, so building a Linux kernel with Cygwin may be possible but will probably not work out of the box.

Different versions of libc will cause a lot of trouble, so a cross-compiler setup -while not strictly necessary- can make things considerably easier.

FWIW, there are a number of embedded Linux offerings available that are designed to spare users most of this trouble. ( Incidentally, my company sells one of those ) Its the old story: You can either learn to do it all by yourself (and learn a lot in the process) or pay some amount and get an easy start. Both ways have their pros and cons and at least with Linux, you have a choice :-)

Rob

--
Robert Kaiser                     email: rkaiser AT sysgo DOT de
SYSGO AG                          http://www.elinos.com
Klein-Winternheim / Germany       http://www.sysgo.de
Reply to
Robert Kaiser

Hi Buddy, I'd like to hear your advice. Can you post it to the group? I didn't put a valid email address because I want to avoid getting automatically signed up for junk mail.

Thanks, Mark

for

the

I'd

Reply to
Mark J

Mark J wrote: : Hi Buddy, I'd like to hear your advice. Can you post it to the group? I : didn't put a valid email address because I want to avoid getting : automatically signed up for junk mail. :

Use an address like ' snipped-for-privacy@foodeletethis.com', or use spamgourmet.com

I think providing no return address is simply not professional, so i'd rather not waste my time.

--buddy

Reply to
Buddy Smith

I
Reply to
Mark J

The term "cross compiler" usually refers to compiling on a CPU architecture that is different than the target. Since your target is x86 and I suspect that your workstation is also x86, you should not be looking for a cross compiler.

If you have a compiler version on the workstation that is incompatible with the kernel version on the target os, then you might get some incompatibility errors, so you just need to be concerned about compiler and library version vs. kernel version.

Tom

Reply to
Penguin Dreams

Penguin Dreams wrote: : : If you have a compiler version on the workstation : that is incompatible with the kernel version on the : target os, then you might get some incompatibility : errors, so you just need to be concerned about : compiler and library version vs. kernel version. :

This shouldn't ever really matter (TM). By that, I mean that it shouldn't, but it wouldn't surprise me if it did. Especially with a 2.2 dev platform and a 2.4 linux kernel.

Something the OP should consider, is that, depending on the target, eCos or netBSD might be a better fit. Linux is so big for an embedded system (caveat: I've never used eCos, and i'm currently building an embedded system using linux)

ttyl,

--buddy : Tom :

Reply to
Buddy Smith

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.