Compiling NXWin on Windows/Cygwin
Posted by George Wright Sun, 27 Jan 2008 00:08:00 GMT
Edit
These instructions have been confirmed not to work. While they may allow NXWin to compile, the buildsystem fails with lots of linker errors… Still scratching my head about how to fix this, but for now I’ve contacted NoMachine about it.
It turns out NXWin isn’t set to compile by default on Cygwin. Anyway, I finally managed to get it to compile inside the nx-X11 tree with a little patching to the source code, and I figured I’d better blog about it for anyone else who is interested in this, and also so that in the inevitable outcome where I forget how I did it, I can fall back on this blog.
First off, you need to edit config/cf/host.def and set the following:
#define NXWinServer YES
#define XWinServer YES
The XWinServer define is probably not needed, but as this machine’s quite a slow compiler I’m not going to change it and see, as contrary to popular belief I don’t like sitting around watching stuff compile.
However, the real fun starts when trying to compile NXWin itself. Turns out it’s broken - I have no idea why, or even how NoMachine themselves compile it, but I had to patch a few lines in various files before it would compile.
The following are the changes I made in programs/Xserver/hw/nxwin:
NXwindow.c:3537
Line should be:
pWin = SaveSetWindow(client->saveSet[j]);
NXdispatch.c:228-229
Lines should be:
volatile char dispatchException = 0;
volatile char isItTimeToYield;
NXdispatch.c:871
Line should be:
result = AlterSaveSetForChildren(client, pWin, stuff->mode, FALSE, TRUE);
NXevent.c:215
Comment out the struct for HotSpot
winmsg.h:74
Comment out the enum for MessageType
You can then just go ahead and compile with make World.
Most of the inspiration for these little patches were taken from the dix/ server.
This, obviously, isn’t ideal, but there’s a dire lack of any documentation for NX on Windows. I know that NoMachine use Cygwin to compile their stuff, but it all seems very hacky (which, to be honest, is the general impression I get of Cygwin) and unpolished.
If anybody who actually knows how to build the NX packages on Windows is reading this, if they could contact me and let me know what the preferred method of compiling NX’s open source components is I’d be most grateful.

I have no experience in particular with NX, but a fair amount with Unixy compiling on Windows. Your description of Cygwin as hacky is correct - it provides basically a Unix compatibility layer, cygwin1.dll, that is needed by everything compiled using the cygwin compiler. (There are ways to use just the shell, make, etc, and use, say, the MS Visual C++ compiler, but I don’t do that so I don’t have more info - maybe see www.abisource.com and the old Windows build docs for info on that.)
If you want to make an honest-to-goodness, real Windows binary, your best bet is MinGW (a native Windows GCC) and MSYS (a corresponding unixish environment to compile in). There are several (many?) projects who produce their Windows binaries this way, since it allows you to use the tools you’re used to (make, auto*, pkg-config) yet still end up with a real Windows binary, not a pseudo-Unix binary with a clumsy dependency.
I’ve got build instructions for some common FOSS libraries and such on my web site - I do the building for AbiWord so have to build some of its deps too. Might be worth a look.
Good luck!