Xming

Building Xming

Cross-build tools

I cross-compile all Xming software for Microsoft Windows; none is built on a Windows PC. These notes are just a very brief outline of a task that may take many hours and requires expert knowledge of compilation tools (e.g. imake, autogen), MinGW, X.Org, Linux and Windows.

To build the software you need a Linux system with native binutils, gcc, make, flex, bison, autotools, cvs, git and the system libraries, and preferably an X.Org X Window system. In order to cross-compile for Windows you additionally need the [WWW]MinGW source packages and binutils source from the [WWW]FSF.

I build a cross-compiler toolchain with prefix $HOME/mingw for mingw32 and then...

Create a link in %HOME/mingw/include

$ ln -s basetsd.h BaseTsd.h
Create links in $HOME/mingw/bin and strip the binaries
$ ln -s mingw32-ar ar
$ ln -s mingw32-as as
$ ln -s mingw32-cpp cpp
$ ln -s mingw32-dlltool dlltool
$ ln -s mingw32-dllwrap dllwrap
$ ln -s mingw32-gcc gcc
$ ln -s mingw32-g++ g++
$ ln -s mingw32-ld ld
$ ln -s mingw32-nm nm
$ ln -s mingw32-objcopy objcopy
$ ln -s mingw32-objdump objdump
$ ln -s mingw32-ranlib ranlib
$ ln -s mingw32-strip strip
$ ln -s mingw32-windres windres
$ ln -s gcc cc
$ $HOME/mingw/bin/strip $HOME/mingw/bin/*
Remove copies of binaries and create links in $HOME/mingw/mingw32/bin
$ rm -f $HOME/mingw/mingw32/bin/*
$ ln -s ../../bin/as .
$ ln -s ../../bin/ld .
also in $HOME/mingw/mingw32/lib
$ ln -s ../../lib/crt2.o .
$ ln -s ../../lib/dllcrt2.o .

Building Pthreads-Win32

Get the [WWW]Pthreads-Win32 source from me here and build the dll.
$ export OLD_PATH=$PATH
$ export PATH=$HOME/mingw/bin:$PATH
$ make clean GC
$ export PATH=$OLD_PATH

Copy the resulting library and headers to the system locations

$ cp sched.h semaphore.h pthread.h $HOME/mingw/include
$ cp libpthreadGC2.a $HOME/mingw/lib
$ cp pthreadGC2.dll $HOME/mingw/bin

Xming source

Get the canonical X.Org source code for... and for external libraries [WWW]FreeType2 and [WWW]zlib

For example...

$ cvs -z3 -d:pserver:anoncvs@cvs.freedesktop.org:/cvs/xorg co -P xc
$ git clone git://anongit.freedesktop.org/git/xorg/proto/x11proto
$ git clone git://anongit.freedesktop.org/git/xorg/lib/libX11
$ git clone git://anongit.freedesktop.org/git/xorg/app/xkbcomp
$ git clone git://git.sv.gnu.org/freetype/freetype2.git
Copy the xserver changes since 21st December 2005 (the monolithic/Imakefile build freeze date) to xc, excluding changes to GL/glx (bugzilla 2996, the dispatch table patch, badly breaks our build, and many others!), miext/shadow/shadow.c and mi/mieq.c. If you have problems: try building the 21st December 2005 monolithic xc tree unpatched and work forwards from that. To understand the complexities of the X.Org modular software build it for your Linux system to replace the distribution version.

Note that all X.Org modular code is now maintained in the [WWW]git repository while the xc monolithic tree is frozen in [WWW]CVS.
The Pthreads-Win32, Xlibs, FreeType2, pixman, xkeyboard-config and zlib libraries are built separately before building the X server.

Also put the patches in the parent directory of xc.

Building Xming

  1. Build the xkeyboard-config metadata using
    $ cd xkeyboard-config
    $ ./autogen.sh --with-xkb-rules-symlink=xorg --disable-runtime-deps
    $ make
    $ make install DESTDIR=/scratch
  2. Patch the source tree and build
    $ cd xc
    $ make World CROSSCOMPILEDIR=$HOME/mingw/bin 2>&1 | tee ../build.log
    $ make install CROSSCOMPILEDIR=$HOME/mingw/bin DESTDIR=/scratch
    
    /scratch is the destination for the build prior to finally copying the appropriate components to the Windows system.

  3. I strip all executables and dlls before building the installer using [WWW]Inno Setup.

  4. Because I cross-build all libraries on Linux, no Windows software development kit can be easily supplied to provide compilation and linkage for third-party X clients.
Note: the Xming X server build still uses Imakefiles, and will continue to use them until modular X.Org cross-compiling with MinGW is fettled. Also libXfont can only be linked static due to weakly defined function stubs which, although making the dll resolve, can't be externally overloaded.

Building XLaunch

Install a copy of the Microsoft XML Parser SDK on a Windows machine and then copy across the header file msxml2.h to the Linux machine used to cross-compile. Also install a copy of the Microsoft help workshop and copy over the header file htmlhelp.h and the library file htmlhelp.lib (rename to libhtmlhelp.a). After building the xc tree go to the xc/programs/Xserver/hw/xwin/xlaunch directory and run make.

Table of contents

  1. Cross-build tools
  2. Building Pthreads-Win32
  3. Xming source
  4. Building Xming
  5. Building XLaunch
Creative Commons License
The [WWW]Xming website, documentation and images are licensed under a
[WWW]Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.
Copyright © 2005-2014 Colin Harrison All Rights Reserved