Prerequisites for Building the Source Code

Required Packages for Building

Many developer libraries and developer tools are required to build Cygwin/X. Several packages are required in addition to the default packages installed by the Cygwin installer. Following is a list of additional packages that are required to compile Cygwin/X natively in Cygwin. Note that some of these packages are meta packages that will automatically cause several other packages to be selected for installation; do not unselect any of these automatically selected packages.

Note: The /usr/share/doc/Cygwin/xorg-server-n.n.n.README file installed with the X server binary package lists up-to-date runtime and build requirements.

Tip: Use setup -q -Ppackagename,packagename,etc. to quickly install the required packages.

Compilation environment setup

libXfont linkage issue

libXfont must be statically linked for the server to start correctly, otherwise it fails with errors loading all fonts, including the mandatory fixed font.

This is due to limitations of Cygwin's current weak symbol handling, which requires static linking to work correctly. For example, in libXfont the RegisterFPEFunctions function is defined weak and should be overloaded with RegisterFPEFunctions defined in dix/dixfont.c in the xserver. However, such overloading will only currently work for Cygwin when libXfont is statically linked with the X server, and not as a shared libary.

If Cygwin's libXfont-devel package contains a shared library stub, /usr/lib/libXFont.dll.a, when building the X server, you must prepare your compilation environment so that the libXfont shared libary stub is not linked with.

A quick and dirty way of achieving this is to move libXFont.la and libXfont.dll.a aside whilst building the X server.


mv /usr/lib/libXFont.la    /usr/lib/libXFont.la.old
mv /usr/lib/libXFont.dll.a /usr/lib/libXFont.dll.a.old

A cleaner way is to generate a customized .pc file for libXfont and arrange for that to be in your PKG_CONFIG_PATH when ./configuring the X server. For example:


sed -e 's| -lXfont| /usr/lib/libXfont.a|' /usr/lib/pkgconfig/xfont.pc > ~/xfont.pc
export PKG_CONFIG_PATH=~:$PKG_CONFIG_PATH