The Great Compile Project

yes, goofy name... the goal? All dependencies for PHP (and GTK so PHP-GTK runs smoothly) and PECL compiled on at least Visual Studio 2005 - in a completely transparent process where source changes and project files and built binaries are available to anyone.

So, I've been slowly working on getting Open Source libraries compiling in five versions of Microsoft Visual Studio. Why? Well, first of all many open source projects don't have good windows support. Any building that is supported is through MinGW - which isn't necessarily bad but the binaries are larger and not as optimized. After all, I would hope Microsoft could make a better compiler for their OS than something brought over from the *nix world. However *nix devs feel comfortable in their old automake/gcc world. Things work the way they expect when building. And people don't LIKE to build for windows - so they don't, so windows users are stuck with very outdated (and I mean very) versions of libraries.

The problem is that Microsoft has moved off of the old MSVCRT runtime that MinGW links against and onto bigger, better (well actually smaller, faster, better) runtimes. In fact the MS documentation says

The msvcrt.dll is now a "known DLL," meaning that it is a system component owned and built by Windows. It is intended for future use only by system-level components.

So your library or application shouldn't be using it. Of course MS couldn't make things easy, these new runtimes have to be distributed separately. And the licensing is dodgy, some claim linking against the dlls violates open source licenses because then you have to distribute the new dll (although MS has separate installers people can download).
And to really confuse you, each new compiler has its own version. There's Visual Studio 2002 (.NET) which will link against msvcr70.dll; There's Visual Studio 2003 (.NET) which will link against msvcr71.dll; There's Visual Studio 2005 (The current "gold standard" of Windows devs) that links against msvcr80.dll; Finally there's Visual Studio 2008, the new kid on the block, that links against msvcr90.dll. Oh, and don't forget the outdated Visual Studio 6 that Microsoft doesn't even distribute anymore, that still links against msvcrt.dll.

Have a headache yet?

Then let's make things more confusing - let's say you have an application with a bunch of dependencies - we'll use PHP as a quick example. PHP on windows requires a branched bindlib static library, libiconv, and libxml2 to compile with the "standard" setup. That doesn't take into account any additional libraries or PECL extensions. It uses some MS stuff as well, but those are Open Source items that it needs. If you take the "standard" versions of the libraries, the ones linked against msvcrt.dll, that are freely available but compile PHP with a newer compiler - let's say 2005 - and link it against msvcr80.dll
Bad things can happen!

What kind of bad things? Crashes, memory corruption, all kinds of madness. So the correct way to allow PHP to change compilers is to also make all the dependencies change compilers as well. Can you say "yuck".

To make things more fun, Visual Studio doesn't support the autotools stuff at all. Even if you use MSYS (which MINGW provides) and hook it up to the windows compiler and linker (which will generate header files at least) it doesn't write useable makefiles, and often has other issues. Which is why PHP5 on Windows has an interesting build system written in JScript that mimics ./configure on *nix. And MSVC is generally a fairly strict compiler - warnings (and often errors) galore. So building Open Source on Windows usually requires hacking header files and fixing compile errors. Fun.

At the moment you can find binaries, source, and MSVC project files for the libraries I've been working on at Perisama if you want to play. There has been discussion of creating some build scripts based on the PHP windows build system, or using a cross-compiler system like cmake for all these libraries. But the bottom line is most of the libraries need hacking to work properly with MSVC, which means "human intervention" at some point in the process.

Anyway, anyone crazy enough to help out is more than welcome. I'm currently working on the GTK dependency stack, which will hit quite a few PHP dependencies and PECL extension dependencies in the process. And yes I'd love to submit my hacks/fixes upstream, if someone could find me some information (where do you send libiconv patches?) Oh, and could you manage to convince people that it's actually important to fix things for Windows, because half of OSS doesn't give a rip... Well this is degenerating into a rant so - enjoy!



A laudable initiative, but I think one that needs more widespread support than just from the php camp.
Just think about all the apps shipping eg libiconv, libeay or zlib. I have many copies of many of those free-sw-fundamentals dlls lying around on my box, and they keep increasing every day: from Apache to Gimp to Pidgin to wireshark. All is fine as long as I don't get stuck into dll-hell, with a wrong gtk dll ending up on my path loaded against the wrong msvcrt (the dreaded pitfall).

Maybe a GO-VS2005 initiative, in the spirit of GO-PHP5 should be initiated, with a wiki where bugs found, known best practices documented, etc...
I think the guys from Apachelounge would be very happy to participate

2008-03-07 8:11 am


A great idea, but unfortunately one that would require a lot of organization, planning, and administration - none of which are my strong suits. So, like the little red hen for now I'll just build it and some more people will come along and help out.

2008-03-07 9:16 am

Edward Z. Yang

I'm another user compiling PHP on Windows, and this sounds like a great initiative. Don't hesitate to contact me if you need any testers, etc. :-)

2008-03-07 11:28 am

Elizabeth Smith's Blog: The Great Compile Project...

Elizabeth Smith has set out on something she calls the Great ......

2008-03-10 3:22 am

Elizabeth Smith’s Blog: The Great Compile Project | Development Blog With Code Updates :

[...] Smith has set out on something she calls the Great Compile Project - her effort to get all dependencies for PHP and PECL compiled on (at the least) Visual Studio 2005 [...]

2008-03-10 6:01 am

Elizabeth Smith’s Blog: The Great Compile Project | PHP Coding Practices - Become an expert PHP Programmer

[...] Smith has set out on something she calls the Great Compile Project - her effort to get all dependencies for PHP and PECL compiled on (at the least) Visual Studio 2005 [...]

2008-03-10 6:29 am


I'd be glad to help out and/or test if I can. I can offer up a VS2008 setup (and 2005 and 2003 if need be... hooray student licensing, eh?)

2008-03-10 6:58 am

Elizabeth Smith’s Blog: The Great Compile Project | Cole Design Studios

[...] Smith has set out on something she calls the Great Compile Project - her effort to get all dependencies for PHP and PECL compiled on (at the least) Visual Studio 2005 [...]

2008-03-10 12:05 pm

Post a Reply