Introduction to Xorg

Xorg is a freely redistributable open-source implementation of the X Window System. This system provides a client/server interface between display hardware (the mouse, keyboard, and video displays) and the desktop environment, while also providing both the windowing infrastructure and a standardized application interface (API).

Package Information

Additional Downloads

Xorg Dependencies


libpng-1.2.12 and Fontconfig-2.3.2



User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/Xorg

Download Instructions

As an alternative to downloading the entire source tree in a single file, there are several smaller files that can be fetched from the download location (directory /pub/X11R6.9.0/src/):

  • X11R6.9.0-src1.tar.gz

  • X11R6.9.0-src2.tar.gz

  • X11R6.9.0-src3.tar.gz

  • X11R6.9.0-src4.tar.gz

  • X11R6.9.0-src5.tar.gz

  • X11R6.9.0-src6.tar.gz

  • X11R6.9.0-src7.tar.gz

The first package contains the Xorg libraries and support programs, the second contains standard X programs, the third contains the X server, the fourth and fifth are fonts, the sixth is normal documentation, and the seventh is hardcopy documentation.

To check the files for integrity, download the md5sums file. Then:

md5sum -c md5sums

For each file you downloaded, an OK status should be displayed.

Kernel Configuration

If you have an Intel P6 (Pentium Pro, Pentium II and later), it is recommended that you compile MTRR (Memory Type Range Registers) support into the kernel. The kernel can map Cyrix and AMD CPUs to the MTRR interface, so selecting this option is useful for those processors also. This option is found in the "Processor type and features" menu. It can increase performance of image write operations 2.5 times or more on PCI or AGP video cards.

In the "Character Devices" section of the "Device Drivers" menu, enable AGP Support and select the chipset support on your motherboard. If you do not know the chipset, you may select all the chip types at the expense of extra kernel size. You can usually determine your motherboard's chipset by running the command lspci, a program from the PCI Utilities-2.2.3 package.

In the "Character Devices" section, disable Direct Rendering Manager unless you have a Direct Rendering Infrastructure (DRI) supported video card. A complete list of DRI supported video cards can be found at http://dri.sourceforge.net in the "Status" section. Currently, supported cards include those from 3dfx (Voodoo, Banshee), 3Dlabs, ATI (Rage Pro, Rage 128, Radeon 7X00, Radeon 2), Intel (i810, i815), and Matrox (G200, G400, G450).

Additionally, NVidia provides their own closed source binary drivers, which do not make use of DRI. If you intend to use these drivers, do not enable DRI.

If you made any changes to the kernel configuration, recompile and install the new kernel.

Installation of Xorg

Various build fixes

The Xorg sources must be patched in order to avoid a race condition with the luit program. Additionally, Xorg contains 5 security vulnerabilities. Fix these issues with the following commands:

patch -Np1 -i ../xorg-6.9.0-luit_race-1.patch &&
patch -Np1 -i ../xorg-6.9.0-security-4.patch

Additionally, if you choose to install Xorg to any prefix other than /usr/X11R6, the luit package needs another correction to fix a hard coded path. Execute the following command:

sed -i 's@/usr/X11R6@</usr>@' programs/luit/parser.h

Suppressing Xprint-related Modification to '/etc'

Xorg insists on putting its boot and profile scripts into the /etc directory even if specifically told not to compile anything Xprint server or client related (see host.def below). The following command will suppress any such modifications:

sed -i '/^SUBDIRS =/s/ etc$//' programs/Xserver/Xprint/Imakefile

Setting Up a Shadow Directory

When building Xorg, you should create a shadow directory of symbolic links for the compiled code. To do that, first make lndir. Starting from the xc directory:

pushd config/util &&
make -f Makefile.ini lndir

Now create the shadow tree:

mkdir ../xcbuild &&
cd ../xcbuild &&
../xc/config/util/lndir ../xc

Creating 'host.def'

The next step is to create the config/cf/host.def file. The documentation for Xorg indicates that the application will build without a host.def file, but the included libraries for Fontconfig and FreeType2 do not build properly on a base LFS system. Therefore, you must specify that these libraries, as well as others, should be imported from the system.



config/cf/host.def is a C file, not a shell script. Ensure the comments delimited by /* ... */ are balanced when modifying the file.

cat > config/cf/host.def << "EOF"
/* Begin Xorg host.def file */

/* System Related Information.  If you read and configure only one
 * section then it should be this one.  The Intel architecture defaults
 * are set for a i686 and higher.  Axp is for the Alpha architecture
 * and Ppc is for the Power PC.  AMD64 is for the Opteron processor.
 * Note that there have been reports that the Ppc optimization line
 * causes segmentation faults during build.  If that happens, try
 * building without the DefaultGcc2PpcOpt line.  ***********/

/* #define DefaultGcc2i386Opt  -O2 -fno-strength-reduce \
                               -fno-strict-aliasing -march=i686 */
/* #define DefaultGcc2AMD64Opt -O2 -fno-strength-reduce \
                               -fno-strict-aliasing */
/* #define DefaultGcc2AxpOpt   -O2 -mcpu=ev6 */
/* #define DefaultGcc2PpcOpt   -O2 -mcpu=750 */

#define HasFreetype2            YES
#define HasFontconfig           YES
#define HasExpat                YES
#define HasLibpng               YES
#define HasZlib                 YES

/* Uncomment the following define if you'd like
 * xdm to use Linux-PAM
#define HasPam                  YES

 * Which drivers to build.  When building a static server, each of
 * these will be included in it.  When building the loadable server
 * each of these modules will be built.
#define XF86CardDrivers         mga glint nv tga s3virge sis rendition \
                                neomagic i740 tdfx savage \
                                cirrus vmware tseng trident chips apm \
                                GlideDriver fbdev i128 \
                                ati DevelDrivers ark \
                                cyrix siliconmotion vesa vga \
                                XF86OSCardDrivers XF86ExtraCardDrivers

 * Select the XInput devices you want by uncommenting this.
#define XInputDrivers           mouse keyboard acecad calcomp citron \
                                digitaledge dmc dynapro elographics \
                                microtouch mutouch penmount spaceorb \
                                summa wacom void magictouch aiptek

/* Most installs will only need this */

#define XInputDrivers           mouse keyboard

/* Xterm is no longer built by default */
#define BuildXterm              YES

/* Disable building Xprint server and clients until we get them figured
 * out but build Xprint libraries to allow precompiled binaries such as
 * Acrobat Reader to run.

#define XprtServer              NO
#define BuildXprintClients      NO

/* Uncomment the following define if you would prefer to install X into
 * /usr or change it to any other location that you prefer.
 * The GL related defines disable compatibility symlinks (the links
 * are not needed when X is installed in /usr).
#define ProjectRoot             /usr
#define LinkGLToUsrInclude      NO
#define LinkGLToUsrLib          NO

/* End Xorg host.def file */

There are several other options that you may want to consider. A well documented example file is config/cf/xorgsite.def.

Build Commands

Install Xorg by running the following commands:

sed -i -e "s@^#include <linux/config.h>@/* & */@" \
    `grep -lr linux/config.h *` &&
( make World 2>&1 | tee xorg-compile.log && exit $PIPESTATUS )

This package does not come with a test suite.

Now, as the root user:

make install &&
make install.man

If you've installed Xorg in the default prefix listed above, run the following commands as the root user:

ln -v -s ../X11R6/bin /usr/bin/X11 &&
ln -v -s ../X11R6/lib/X11 /usr/lib/X11 &&
ln -v -s ../X11R6/include/X11 /usr/include/X11

The Xorg fonts have been installed outside of Fontconfig's default search path of /usr/share/fonts. In order for Fontconfig to find the installed TrueType fonts, you should make symlinks to their directories. Assuming you've installed Xorg in the default prefix, run the following commands as the root user:

install -v -d -m755 /usr/share/fonts &&
ln -svn /usr/X11R6/lib/X11/fonts/TTF /usr/share/fonts/X11-TTF

You should now continue on to the X Window System Components section to complete the configuration of Xorg.

Command Explanations

sed -i -e "s@^#include <linux/config.h>@...: The Linux-Libc-Headers package installed in LFS installs a /usr/include/linux/config.h file which is not compatible with userspace applications. The recommended fix for applications including this file is to remove it (see linux-libc-headers FAQ). The sed uses grep -lr to replace all occurrences. If you desire, just remove (comment) the line in the appropriate video driver file if you customized host.def.

( make World 2>&1 | tee xorg-compile.log && exit $PIPESTATUS ): This command runs multiple Makefiles to completely rebuild the system. 2>&1 redirects error messages to the same location as standard output. The tee command allows viewing of the output while logging the results to a file. The parentheses around the command runs the entire command in a subshell and finally the exit $PIPESTATUS ensures the result of the make is returned as the result and not the result of the tee command.



When rebuilding Xorg, a separate command that may be used if only minor changes are made to the sources is make Everything. This does not automatically remove generated files and only rebuilds those files or programs that are out of date.

ln -v -s ...: These commands are present to enable other (broken) packages to build against Xorg, even though the Filesystem Hierarchy Standard says: “In general, software must not be installed or managed via the above symbolic links. They are intended for utilization by users only.

For a list of the package contents, see the sections in the XFree86 Contents and Descriptions.

Last updated on 2007-01-18 23:06:26 -0600