DRI Compilation Guide : Compiling the XFree86/DRI tree
Previous: Updating your CVS sources
Next: Installing

7. Compiling the XFree86/DRI tree

7.1. Make a build tree

Rather than placing object files and library files right in the source tree, they're instead put into a parallel build tree. The build tree is made with the lndir command:

            cd ~/DRI-CVS
            ln -s xc XFree40
            mkdir build
            cd build
            lndir -silent -ignorelinks ../XFree40

The build tree will be populated with symbolic links which point back into the CVS source tree.

Advanced users may have several build trees for compiling and testing with different options.

7.2. Edit the host.def file

The ~/DRI-CVS/build/xc/config/cf/host.def file is used to configure the XFree86 build process. You can change it to customize your build options or make adjustments for your particular system configuration

The default host.def file will look something like this:

            #define DefaultCCOptions -Wall
            #define DefaultGcc2i386Opt -O2
            #define LibraryCDebugFlags -O2
            #define BuildServersOnly YES
            #define XF86CardDrivers vga tdfx mga r128 i810
            #define LinuxDistribution LinuxRedHat
            #define DefaultCCOptions -ansi GccWarningOptions -pipe
            #define BuildXF86DRI YES
            #define HasGlide3 YES  
            /* Optionally turn these on for debugging */
            /* #define GlxBuiltInTdfx YES */
            /* #define GlxBuiltInMga YES */
            /* #define GlxBuiltInR128 YES */
            /* #define DoLoadableServer NO */
            #define SharedLibFont NO
The ProjectRoot variable specifies where the XFree86 files will be installed. You probably don't want to use /usr/X11R6/ because that would overwrite your default X files. The following is recommended:
            #define ProjectRoot /usr/XF86-main

Especially note the XF86CardDrivers line to be sure your driver is listed.

If you have 3dfx hardware be sure that the Glide 3x headers are installed in /usr/include/glide3/ and that the Glide 3x library is installed at /usr/lib/libglide3x.so.

If you do not have 3dfx hardware comment out the HasGlide3 line in host.def.

7.3. Compile

To compile the complete DRI tree:

            cd ~/DRI-CVS/build/xc/
            make World >& World.LOG
Or if you want to watch the compilation progress:
            cd ~/DRI-CVS/build/xc/
            make World >& World.LOG &
            tail -f World.LOG
With the default compilation flags it's normal to get a lot of warnings during compilation.

Building will take some time so you may want to go check your email or visit slashdot.

7.4. Check for compilation errors

Using your text editor, examine World.LOG for errors by searching for the pattern ***.

Verify that the DRI kernel module(s) for your system were built:

          cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel

For the 3dfx Voodoo, you should see tdfx.o. For the Matrox G200/G400, you should see mga.o. For the ATI Rage 128, you should see r128.o. For the Intel i810, you should see i810.o.

If the DRI kernel module(s) failed to build you should verify that you're using the right version of the Linux kernel. The most recent kernels are not always supported.

If your build machine is running a different version of the kernel than your target machine (i.e. 2.2.12-20 vs. 2.3.99-pre6), make will select the wrong kernel headers. This can be fixed by explicitly setting the value of TREE. If the path to your kernel source is /bigdisk/linux-2.3.99-pre6,

          cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
          make TREE=/bigdisk/linux-2.3.99-pre6
or alternatively, edit Makefile to include this change.

After fixing the errors, do make World again. Later, you might just compile parts of the source tree but it's important that the whole tree will build first.

DRI Compilation Guide : Compiling the XFree86/DRI tree
Previous: Updating your CVS sources
Next: Installing