Installing freetype, libXft, and libXrender

If you get the following errors when compiling programs that use freetype fonts, you will need to install libXft and possibly libXrender.
/usr/X11R6/include/X11/Xft/Xft.h:52: error: syntax error before `;' token
/usr/X11R6/include/X11/Xft/Xft.h:86: error: 'FT_UInt' is used as a type, but is 
    not defined as a type.
/usr/X11R6/include/X11/Xft/Xft.h:93: error: 'FT_UInt' is used as a type, but is 
    not defined as a type.

Attempt to install libXrender (unsuccessful)

LibXrender is part of Xfree86 and won't compile on older systems, because the older versions of XFree86 are lacking critical include files needed by libXrender. LibXrender also uses the pkg-config system, which means you must create a ".pc" file before it will compile. Otherwise, you will get the error:
checking for render >= 0.8... Package render was not found in the 
pkg-config search path.
Perhaps you should add the directory containing `render.pc'
to the PKG_CONFIG_PATH environment variable
No package 'render' found

configure: error: Library requirements (render >= 0.8) not met; 
consider adjusting the PKG_CONFIG_PATH environment variable if 
your libraries are in a nonstandard prefix so pkg-config can find them.

  1. cd /usr/lib/pkgconfig
  2. copy one of the files into render.pc
    cp gdk.pc render.pc
    and edit it as follows:
    prefix=/usr
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib
    includedir=${prefix}/include
    
    Name: render
    Description: render
    Version: 1.2.10
    Requires: 
    Libs: -L${libdir}   -L/usr/X11R6/lib -lgdk   -lXi -lXext -lX11  -lm
    Cflags: -I${includedir}/gtk-1.2  -I/usr/X11R6/include

Next, compile libXrender:

  1. tar -xzvf libXrender-0.8.4
  2. cd libXrender-0.8.4
  3. ./configure
  4. make

On my system, "make" bombed out with numerous undeclared symbols and parse errors. Fortunately, libXrender was only necessary for creating static versions of the program and the existing libXrender worked satisfactorily for dynamically linked programs.

Installing libXft and freetype2

Install a new version of libXft from http://xlibs.freedesktop.org/release/ and new version of freetype from http://freetype.org/ using the standard procedure:

   tar -xzvf <filename>
   cd <directory>
   ./configure  --sysconfdir=/etc --prefix=/usr
   make 
   make install 

Unless you add the --prefix argument, libXft installs itself in /usr/local. Freetype installed in /usr/include/freetype2. Before they would work, it was necessary to move the files to the correct locations to make sure the compiler could not see the old versions.

If you get the following error messages:
../include/X11/Xft/Xft.h:62: error: syntax error before '_XftFTlibrary'
../include/X11/Xft/Xft.h:62: warning: type defaults to 'int' in declaration of '_XftFTlibrary'
../include/X11/Xft/Xft.h:62: warning: data definition has no type or storage class
This means that the version of libXft on your system is not working. Remove the old versions of the libXft libraries and include files
su
cd /usr/X11R6/lib
mkdir libxft-old
mv libXft* libxft-old
cd /usr/X11R6/include/X11
mv Xft Xft.bak
and compile and install a new version of libXft. The very latest version of Xft is not necessarily the best. I have had the best results with version 2.1.6.

Once the new libXft is installed, re-run 'configure' on your program again to make sure it finds the new version. Configure scripts need to execute "freetype-config --cflags" to find where the include files are located.

If you get the following message, it is bad news:
 checking X11/extensions/Xrender.h usability... no
 checking X11/extensions/Xrender.h presence... no
 checking for X11/extensions/Xrender.h... no
 configure: error: Xrender.h not found.
This means that your version of X does not have the Xrender extension and you need to upgrade to a newer version of X.


Back