Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

OGRE build error: freetype package could not be located

📅 2015-Feb-13 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ ogre ⬩ 📚 Archive

FreeType error in CMake GUI

Problem

I was trying to build OGRE on Ubuntu:

$ mkdir build
$ cd build
$ cmake ..

CMake threw this error:

CMake Error at CMake/Utils/MacroLogFeature.cmake:100 (MESSAGE):
  -----------------------------------------------------------------------------
  -- The following REQUIRED packages could NOT be located on your system.
  -- Please install them before continuing this software installation.
  -- If you are in Windows, try passing -DOGRE_DEPENDENCIES_DIR=<path to dependencies>
  -----------------------------------------------------------------------------
  + freetype: Portable font engine <http://www.freetype.org>

CMake complained that it could not find the FreeType package. But, I had already installed both the libfreetype6 and libfreetype6-dev packages.

Solution

The dependency on FreeType is listed in the CMake/Dependencies.cmake file in the OGRE source. OGRE seems to be using its own CMake script to find FreeType located at CMake/Packages/FindFreetype.cmake. This script seems to be failing to locate some file or directory of FreeType, even though it is installed.

I solved this by opening the CMake GUI:

$ cmake-gui ..

Enable Advanced and Grouped so that its easy to view the results. Click Configure. The same FreeType error is thrown up. But, now we can see that for some reason the FREETYPE_INCLUDE_DIR is not being found. I set this to /usr/include/freetype2. Click Configure again and the error is gone. Then click Generate. Compilation worked fine after this.

Tried with: OGRE 1.8 and Ubuntu 14.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧