Cross compiling under Windows for Linux

I have two headless servers I am writing code for, and a Windows box networked with them.

I want to compile my code within an IDE on the Windows box (eclipse most likely) and run the compiled binarys on the Linux boxes.

Will this work?
Using Cygwin (or MinGW)?
Thoughts?

Cheers, Ian

Only if you are using a cross-compiler...one that specifically supports creating an executable for the target x86 Linux box.

And GCC under Cygwin is?

The problem is not the compiler per se, but the linker. Googling for "windows linux cross compile", the first result is http://metamod-p.sourceforge.net/cross-compiling.on.windows.for.linux.html

To compile and link for linux, assuming a compiler capable of it, you'd need to have all the linux headers and all the linux libraries and objects. Which is halfway to having linux in its entirety.

VMWare server / Virtualbox with a linux install would an easier way.

You could set up your source tree as a shared filesystem between windows and the VM and do your compile in the VM.

Hi,

Resurrecting this old thread.

I am in a similiar situation, however, we already have a native compiler on linux that will build 32bit and 64bit linux cross compilers. Now we want to go a step further and be able to cross-compile on a Windows host. The native compiler is based on GCC 3.3.3 and built with GCC 3.3.3, while the cross-compilers are GCC 4.1.2 compliant. We have sysroots in place for 32bit and 64bit, and the native compiler, and link in the source codes for GCC and Binutils. My question is, if we the criteria above, is it really necessary for me to install the crosstool mentioned in the link regarding cross-compiler in cygwin? Would it be sufficient to build the native compiler with Cygwin GCC 3.3.3 and link in necessary rpms (which we extract of course) from the linux distros), and then with the native compiler build the cross-compilers?

I would like to do as little changes as possible in the code we already have. Right now we build everything with make, and the source codes and binaries from the linux distros (we only take what it necessary, so only the relevant rpms are stored) are in rpm format.. The native compiler is buillt in a similiar way, i.e. source code for binutils, gcc from the linux distro are available, in addition to a set of rpm binaries.

So I guess install cygwin, gcc 3.3.3, rpm tools, and gnu make?

Thanks in advance!

No, it is not sufficient to borrow a few linux RPMs. To wit:

Cross-compiling is for different architectures of the same OS. Just compile in Linux already.

So I would need kernel stuff aswell? Ok in that case it is a bad idea.