Install FreeType From Source
Contents
1. Download
2. Install FreeType
2-1. For CentOS / Ubuntu / MacOS
3. Configure Options
4. Create Symbolic Link
5. Setting Environment Variable
6. [Option] Install libpng From Source
7. [Option] Install HarfBuzz From Source
8. Error Handling
8-1. fatal error: hb-ft.h: No such file or directory
Download
FreeType Official Site
https://www.freetype.org/Install FreeType
For CentOS / Ubuntu / MacOS
※ When installing version 2.10.1
Terminal
# wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz # tar xvfz freetype-2.10.1.tar.gz # cd freetype-2.10.1 # ./configure --prefix=/usr/local/freetype/2_10_1 --enable-freetype-config # make # make install
Configure Options
--prefix
the installation path
--enable-freetype-config
Enable freetype-config
Create Symbolic Link
Create installed libraries to under "/usr/local" by symbolic link.
Terminal
// /usr/local/bin # ln -s /usr/local/freetype/2_10_1/bin/freetype-config /usr/local/bin/ // /usr/local/include # ln -s /usr/local/freetype/2_10_1/include/freetype2 /usr/local/include/ // /usr/local/lib # ln -s /usr/local/freetype/2_10_1/lib/libfreetype.a /usr/local/lib/ # ln -s /usr/local/freetype/2_10_1/lib/libfreetype.la /usr/local/lib/ # ln -s /usr/local/freetype/2_10_1/lib/libfreetype.so /usr/local/lib/ # ln -s /usr/local/freetype/2_10_1/lib/libfreetype.so.6 /usr/local/lib/ # ln -s /usr/local/freetype/2_10_1/lib/libfreetype.so.6.17.1 /usr/local/lib/ // /usr/local/lib/pkgconfig # ln -s /usr/local/freetype/2_10_1/lib/pkgconfig/freetype2.pc /usr/local/lib/pkgconfig/
Setting Environment Variable
Setting LD_LIBRARY_PATH and PKG_CONFIG_PATH variables is useful when building or executing other sources.
When copying or creating a symbolic link the library installed under /usr/local, it is recommended to set it.
Terminal
$ vim ~/.bash_profile
.bash_profile
... export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH ...
[Option] Install libpng From Source

Install libpng From Source
[Option] Install HarfBuzz From Source

Install HarfBuzz From Source
Error Handling
fatal error: hb-ft.h: No such file or directory
Need to install HarfBuzz compled FreeType.
Here is the fix way.
Terminal
// [FreeType] Compile without HarfBuzz. # ./configure --with-harfbuzz=no ... Library configuration: harfbuzz: no (pkg-config) # make # make install // [HarfBuzz] Compile with FreeType. # ./configure # make # make install // [FreeType] Compile with HarfBuzz. # ./configure ... Library configuration: harfbuzz: yes (pkg-config) # make # make install