Windows (mingw32) compilation

Andrew Oakley andrew at
Mon Apr 14 15:15:44 PDT 2008

I am trying to build an Xserver for windows that based on something half 
recent (actually I'm getting it out of git).  So far I have discovered a 
number of fairly trivial problems which shouldn't be too hard to fix if 
you know the build system (I'm really not good with autotools).

I realise there are some old (unmaintained) windows X servers out there 
such as Xming and Xwin, however no-one seems to have built an Xserver 
using the new build system, so I'm having a go, with the aim of getting 
a working Xinerama/RandR implemtaion for windows.  Any pointers would be 
appreciated :).

The contents of Xpoll.h are in a huge #ifdef WIN32 ... #else ... #endif. 
  The POSIX version wants to know implementation details for the FD_SET 
structure, and we test for a number of different implementations in the 
configure script.  This fails as we have a windows implementation that 
uses something that isn't tested for.  I think we should have 2 
versions, a POSIX version and a WIN32 version (I just deleted the unused 
half of the file to get it to "build").

We try and use recvfrom (and something else, I can't remember what) but 
don't link against ws2_32.dll (winsock)).  I made this build by adding 
the required "-lws2_32" to the LDFLAGS environment variable.  I get the 
impression that you should be able to fix this by adding ws2_32 to the 
AC_SEARCH_LIBS line in, but that didn't seem to work (the 
generated configure script seems broken so that it will always decide 
that no extra libraries are needed).

I'm somewhat confused as to the purpose of this file.  In any case, we 
try to create pthread_self with the wrong signature, and the comparison 
in __pthread_equal_stub fails.  See pthread-stubs.patch (I get the 
impression this should never actually be called so the undefined return 
doesn't matter).

It doesn't look like this has ever worked on windows, so I'll have a go 
at hacking it so it does (or at least build so I can continue in my 
quest for an Xserver).  I'm guessing this will take me a while, but I'll 
post a patch (or my troubles with autotools :P) when I'm done.

Andrew Oakley
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pthread-stubs.patch
URL: <>

More information about the xorg mailing list