Cross compiling to Windows

9 views
Skip to first unread message

Ryan McDougall

unread,
Jan 16, 2009, 11:07:47 AM1/16/09
to realxtend-a...@googlegroups.com
We have been having an awfully frustrating time trying to get various
xplatform technologies that happened to start with linux compiling on
windows. It hasn't been because the code wasn't portable -- almost all
of it is extremely portable. Its been because the build systems are
very different. And the only one that works well on both, cmake, is
not nearly as common as it should be.

Initially I wanted to cross compile from linux to windows, and the
support is theoretically there, but in practise autotools has never
supported windows well. However, Fedora 11 will have native support to
cross-compile to windows with the following lines:

yum install mingw32-*
./configure --host=i686-pc-mingw32
make

http://lwn.net/Articles/307732/
http://fedoraproject.org/wiki/MinGW

Cheers,

Kripken

unread,
Jan 16, 2009, 11:24:11 AM1/16/09
to realxtend-a...@googlegroups.com
On Fri, Jan 16, 2009 at 6:07 PM, Ryan McDougall <semp...@gmail.com> wrote:

Its been because the build systems are
very different. And the only one that works well on both, cmake, is
not nearly as common as it should be.



SCons works well on both Windows and Linux in my experience (it's used by the SL viewer, Blender, etc).

I certainly agree that next-gen build systems like SCons and CMake should be more popular.

Ryan McDougall

unread,
Jan 16, 2009, 11:35:59 AM1/16/09
to realxtend-a...@googlegroups.com

A bit off topic: having never tried it, I've always thought SCons
should rule the world -- but almost no one who works with it seems to
agree. Witness KDE, SL, and anywhere else I google. Do you know why
that is?

Cheers,

Kripken

unread,
Jan 16, 2009, 12:06:43 PM1/16/09
to realxtend-a...@googlegroups.com

Well, the KDE debacle was three years ago, back then SCons wasn't mature enough. I am not familiar with SL's complaints about SCons, so I can't comment about that, but from SL's publicly available code, they were using a single huge SConstruct file, which was furthermore written in what I would call a convoluted manner (I think the same about a lot of their code, so maybe that's no coincidence).

Btw, speaking of "anywhere else I google", Google uses SCons.

Ryan McDougall

unread,
Jan 16, 2009, 12:14:31 PM1/16/09
to realxtend-a...@googlegroups.com

Well reX hasn't decided on a build tool, and I think the choices are
cmake and scons. Want to be a scons advocate? :)

Cheers,

Kripken

unread,
Jan 16, 2009, 2:21:50 PM1/16/09
to realxtend-a...@googlegroups.com
Well reX hasn't decided on a build tool, and I think the choices are
cmake and scons. Want to be a scons advocate? :)


Well, I'm still waiting to see if I'm going to be collaborating with realXtend, but sure, I'm always willing to advocate for worthy open source software :)

daniel miller

unread,
Jan 16, 2009, 11:28:28 PM1/16/09
to realxtend-a...@googlegroups.com
just to be the old fart --

what exactly is the pressing reason not to use cygwin + gnu tools
(configure, make etc)

Not that I love that toolchain, far from it. However it's certainly
mature on both platforms.

Python-ogre is a nice example of where we don't want to end up --
hopeless compile hell on all platforms.

Ryan McDougall

unread,
Jan 17, 2009, 12:58:08 AM1/17/09
to realxtend-a...@googlegroups.com
On Sat, Jan 17, 2009 at 6:28 AM, daniel miller <danb...@gmail.com> wrote:
>
> just to be the old fart --
>
> what exactly is the pressing reason not to use cygwin + gnu tools
> (configure, make etc)

Depends on the perspective: if you're talking about doing reX in
cygwin/autotools I think half our programmers would rather commit
ritual suicide than work with autotools. I can't say as I have much
reason to condemn that line of thinking.

If you're talking about building things like Telepathy of Gstreamer
with cygwin on windows, I think you'll find that GNU autotools, or at
least the way most developers implement them, assumes a near complete
GNU system is available, so you have to essentially install one.

The thing with the cross compiler, is it runs on an entirely complete
GNU system, so the steps of forcing either me to install windows then
install a fake GNU on windows, or forcing our windows programmers to
learn GNU to make windows binaries, is removed from the equation.

For example, Telepathy-glib's automake file assumes both bash and
python are installed, so it can autogenerate C code. In cygwin, we
have to spend our time massaging that to work some how. With the cross
compiler, it works as intended.

The only down side is the compiler is GCC, not MSVC, though I don't
know precisely what that implies.

> Not that I love that toolchain, far from it. However it's certainly
> mature on both platforms.
>
> Python-ogre is a nice example of where we don't want to end up --
> hopeless compile hell on all platforms.

I agree its an under appreciated issue.

Cheers,

daniel miller

unread,
Jan 17, 2009, 1:33:28 AM1/17/09
to realxtend-a...@googlegroups.com
> Depends on the perspective: if you're talking about doing reX in
> cygwin/autotools I think half our programmers would rather commit
> ritual suicide than work with autotools. I can't say as I have much
> reason to condemn that line of thinking.

well then I think I can save you some time. I've seen this argument
countless times when both die-hard Windows and 'nix developers were
working on the same project, and inevitably, every single time, in the
end you have two build systems, one MSVC-based for windows and one
GNU-based for unix. Might as well cut to the chase and accept that
fact at the start. At least you can insist that directory structure
be identical. Just put the .sln files in a separate folder is all I
ask.

That's for C++ -- .net and Java are a different matter.

Mike Mazur

unread,
Jan 17, 2009, 2:22:46 AM1/17/09
to realxtend-a...@googlegroups.com
Hi,

You may also want to have a look at waf[1]. From the website:

Waf is a Python-based framework for configuring, compiling and installing
applications. It derives from the concepts of other build tools such as Scons,
Autotools, CMake or Ant.

It doesn't specifically mention cross-platform compilation as a feature, but
searching for "windows" in all issues in their bugtracker turns up a few.

Mike


[1] http://code.google.com/p/waf/

Ryan McDougall

unread,
Jan 17, 2009, 2:26:19 AM1/17/09
to realxtend-a...@googlegroups.com

Actually cmake does a good job of generating both unix makefiles and
VS sln files. It's used by KDE and SL viewer.

Have yet to use scons or waf.

Cheers,

Kripken

unread,
Jan 17, 2009, 2:51:29 AM1/17/09
to realxtend-a...@googlegroups.com

SCons can also generate Visual Studio project/solution files. I haven't used it myself however, I am happy with just invoking SCons on the commandline for both Linux and Windows; works great with GCC on Linux and VS2008 on Windows. Some minor tweaking is necessary for platform-specific stuff, but as SConstruct files are Python code, that's not a problem.

Toni Alatalo

unread,
Jan 18, 2009, 11:59:08 PM1/18/09
to realxtend-a...@googlegroups.com
Ryan McDougall kirjoitti:
> have to spend our time massaging that to work some how. With the cross
> compiler, it works as intended.
> The only down side is the compiler is GCC, not MSVC, though I don't
> know precisely what that implies.
>

I think the concern there is efficiency of the resulting code. Haven't
looked at any benchmarks though. The official Windows releases of both
Python and Blender are compiled with Visual Studio, even though I bet
especially among Python devs there are people who know cross compiling.
Am supposing efficiency is the reason. The only place where I've come
across people actually using cross compiling recently is when people
build apps for their Linux-running mobile phones.

Regarding build systems, almost all are used by Blender so we have some
experience in there :) Scons is the easiest way to build Blender on any
platform - including Windows using MinGW. You just need the svn
checkout, especially on win and mac the dependencies also from the
repository (on linux i've installed them from the distro, but could have
used the versions in the dependencies svn too), install scons and run
it. Scons is the definitely most common build system by the users
(artists) who compile svn almost daily to get new features. However, to
be able to use Visual Studio some Windows devs maintain VS project files
separately, and I think those are used for the official Win releases.
And furthermore there are the old farts ;) who like (?) make, so the
original makefiles are also maintained by actually the lead dev (on a
mac but that's unix). *And* more recently cmake was introduced too, I
guess to perhaps replace the manual work on VS project files (and scons
too?), but I'm not sure what has happened with that.

I'll look a bit into how cmake has worked there and ask people who know
if happen to see them on irc soon.

> Cheers,
>

~Toni

Ryan McDougall

unread,
Jan 19, 2009, 12:49:22 AM1/19/09
to realxtend-a...@googlegroups.com
On Mon, Jan 19, 2009 at 6:59 AM, Toni Alatalo <ant...@kyperjokki.fi> wrote:
>
> Ryan McDougall kirjoitti:
>> have to spend our time massaging that to work some how. With the cross
>> compiler, it works as intended.
>> The only down side is the compiler is GCC, not MSVC, though I don't
>> know precisely what that implies.
>>
>
> I think the concern there is efficiency of the resulting code. Haven't
> looked at any benchmarks though. The official Windows releases of both
> Python and Blender are compiled with Visual Studio, even though I bet
> especially among Python devs there are people who know cross compiling.
> Am supposing efficiency is the reason. The only place where I've come
> across people actually using cross compiling recently is when people
> build apps for their Linux-running mobile phones.

I supposed that msvc generated better code than gcc, but the question
is precisely how much better. We should investigate somewhat.

The modules in question would be communications and streaming, not 3D
or other fast paths, so I am guessing speed isn't a primary concern
just yet.

What I am more worried about is ABI compatibility. In theory, GCC
should use all windows calling conventions, especially since its C
(not C++). In reality I know that windows is a special beast, and GCC
versions have sometimes been ABI incompatible with themselves!

>
> Regarding build systems, almost all are used by Blender so we have some
> experience in there :) Scons is the easiest way to build Blender on any
> platform - including Windows using MinGW. You just need the svn
> checkout, especially on win and mac the dependencies also from the
> repository (on linux i've installed them from the distro, but could have
> used the versions in the dependencies svn too), install scons and run
> it. Scons is the definitely most common build system by the users
> (artists) who compile svn almost daily to get new features. However, to
> be able to use Visual Studio some Windows devs maintain VS project files
> separately, and I think those are used for the official Win releases.
> And furthermore there are the old farts ;) who like (?) make, so the
> original makefiles are also maintained by actually the lead dev (on a
> mac but that's unix). *And* more recently cmake was introduced too, I
> guess to perhaps replace the manual work on VS project files (and scons
> too?), but I'm not sure what has happened with that.
>
> I'll look a bit into how cmake has worked there and ask people who know
> if happen to see them on irc soon.
>
>> Cheers,
>>
>
> ~Toni

Well with the mention of Scons, and now waf, I think build tool is a
fair research topic.

Cheers,
Reply all
Reply to author
Forward
0 new messages