views:

225

answers:

4

Is there any way I can cross-compile C/C++ code for Windows (XP, Vista, Win7), ideally in 64-bit as well as 32-bit (for Vista and Win7), from a Solaris or OpenSolaris setup? My codebase is already cross-platform, I would like to cross-compile it (generate windows DLLs and EXEs) from Solaris or Linux as part of an automated process.

I would like to use the GCC suite, and would rather not need to use the Cygwin DLLs, if possible.

If it is possible, which tools would I need in my Solaris environment? How would I go about compiling/linking an entire project?

If this is not possible in Solaris, how should I proceed from Linux, considering I would like 32- and 64-bit binaries for all of the versions of Windows I have mentioned?

Thanks in advance for any help!

+2  A: 

I'm not sure if you want cross-compilation (creation of Windows EXE files on the the Solaris box) or cross-platform (code that compile on Solaris or Windows). The latter is easier, and to do it you should start by installing the MinGW version of the GCC compiler on your Windows box.

anon
My codebase is already cross-platform, I would like to cross-compile it (generate windows DLLs and EXEs) from Solaris or Linux as part of an automated process.
Marc-Antoine
I've updated your question to reflect this.
anon
MinGW definitely looks interesting. Do binaries generated using MinGW have dependencies (such as cygwin.dll) other than those I explicitely want to link to or to system binaries (such as kernel32.dll)?
Marc-Antoine
They are dependemt on the the system binaries (of course) and on msvcrt.dll, which should be installed on any modern versions of windows. There is no equivalent of cygqin.dll that needs to be installed.
anon
I'll give it a try and see how it goes, thanks!
Marc-Antoine
A: 

There is no 64-bit cross-compiler for Windows, you have to compile it using MSVC compiler :(

Paul Betts
what about http://mingw-w64.sourceforge.net/ ?
Christoph
Interesting - I'd heard that this existed, but it was a hacky patchset and wasn't usable. Has this changed?
Paul Betts
+1  A: 

howto: Creating a cross Win32 and Win64 compiler

Christoph
A: 

Er, why not just automate your build process by performing a remote build process? It's what we do - we have CruiseControl.NET on a Windows box which performs remote builds on Linux and Solaris via sshexec. I'm sure it would be possible the other way round.

Robert Tuck