Recommended Compiler for Building FontForge
Building FontForge directly from its GitHub repository requires a modern C and C++ compiler compatible with the project's CMake build system. This guide covers the recommended compilers across supported operating systems, the required standards, and the optimal environment setup to ensure a successful compilation.
The Recommended Compilers: GCC and Clang
For building FontForge on Unix-like environments, the officially supported and recommended compilers are GCC (GNU Compiler Collection) and Clang (LLVM). FontForge's codebase relies on modern language standards, requiring a compiler that supports at least C99 for C source files and C++11 (or newer) for C++ components.
Recommendations by Operating System
- Linux: GCC is the standard and
most tested compiler for building FontForge on Linux distributions such
as Ubuntu, Debian, Fedora, and Arch Linux. Alternatively,
Clang is fully supported and frequently used for
testing and development. Most package managers allow you to install GCC
via packages like
build-essential(Debian/Ubuntu) orgccandgcc-c++(Fedora/RHEL). - macOS: Apple Clang provided
through the Xcode Command Line Tools is the primary recommended
compiler. It can be installed using the command
xcode-select --install. You can also use LLVM or GCC installed via Homebrew or MacPorts. - Windows: The officially documented and community-recommended method for compiling FontForge on Windows is using GCC via MinGW-w64 inside an MSYS2 environment. This setup provides a Unix-like toolchain and handles dependencies cleanly. While experimental support for Microsoft Visual C++ (MSVC) exists, MinGW-w64 remains the standard and most reliable choice for building from the GitHub repository.
Build Tool Requirements
Regardless of the compiler chosen, FontForge utilizes CMake (version 3.14 or later) to generate the build configuration. When invoking CMake, it will automatically detect the system's default C and C++ compilers. You can explicitly specify your preferred compiler using environment variables or CMake flags:
cmake -B build -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++Using up-to-date versions of GCC or Clang ensures complete compatibility with FontForge’s dependencies, including FreeType, Cairo, Pango, and Libxml2.