Factor Language Blog

Adventures with Cygwin on 64-bit Windows

Friday, November 23, 2007

Warning: this is a rant. If you don’t like rants, skip this post and look at my previous post, which is a lot more substantial than this one.

So at FactorCon 2007, Doug and I experimented with getting Factor going on 64-bit Windows XP. The Factor compiler and FFI is ready to go, and it should be an easy port in theory, but the only problem is that we have to compile the VM (which is written in C). And this isn’t trivial at all. Here is what we found:

  • First of all, Factor compiled with 32-bit Cygwin runs in 32-bit mode under “WoW emulation”, however certain features don’t work, for example UDP support. This is a bug in Windows and there’s nothing we can do; a C testcase demonstrates the problem quite clearly. The problem is not present in 64-bit mode.
  • Cygwin also ships with broken implementations of certain C runtime functions, such as _osf_openhandle(). We have a testcase which fails in Cygwin and works in Visual Studio (I reported the bug to the Cygwin guys.)
  • 32-bit Mingw is highly unstable on 64-bit Windows – you need an obscure workaround just to get it to run at all – however it does not suffer from the _osf_openhandle() bug. The UDP sockets problem is still there since its a Windows bug, not specific to Cygwin or Factor.
  • There’s a 64-bit Mingw port in progress, however we were unable to get it to work. Using optimization flags crashes gcc; without optimization flags gcc produces a non-functioning binary, and PE Explorer claims this binary is corrupt.
  • There are no plans at all to port Cygwin to 64-bit Windows.

So the executive summary is that we’re pretty much fucked when it comes to 64-bit Windows support, and all because I made a serious miscalculation and used GNU C extensions in the VM. I should have stuck with semi-portable C and then we could use Visual Studio…

If we could compile the Factor VM as a 64-bit binary, then porting the rest of Factor would be trivial; after all, we support Windows, and we support AMD64, and we’re awesome programmers. However, the GNU hippies fucked up once again and failed to deliver – AMD64 chips have been out since 2004 and Windows XP x64 edition was released at the start of 2005, but at the end of 2007, more than two years later, there is still no stable 64-bit GNU toolchain available for Windows.

I realize that this is all just people’s hobbies, they work on Cygwin/Mingw in their spare time, I shouldn’t expect timely releases or stability of any sort, etc. But hell, if you GNU people want “world domination”, if you want us to stop using Mac OS X, Windows and other commercial software, if you want market share greater than 0.00001%, if you want people to take GNU and Linux seriously, get to work and fix your shit. Thank you.