How do I use the FreeType library in Platformio

  • This is my error, I want to know the correct configuration method

Where is the source of that library? I can’t find anything in the library manager hence the error.

I used apt-get install to install it.

$apt-get install libfreetype6-dev
  • System Linux

I want to use libraries installed in Linux, such as freetype, in Platformio

But you’re compiling a firmware for ESP32. You can’t simply link a library you’ve installed in Linux for an ESP32, they’re completely different binary architectures (x84_64 vs. XTensa).

Also you would include it differently. You would do a build_flags expression where you -I the include folder for the library and then -L the folder where the statically compiled .a library is and then link it with -l<library name>. But again, you can’t simply link to the Linux version of that library since they’re binary incompatible.

You can only use lib_deps per docs on libraries that exist in the PlatformIO registry (PlatformIO Registry) or the name of a library that’s stored in the lib/ folder of your project.

In order for this to work, the library needs to be compatible / compilable for the ESP32

I don’t know what you’re trying to do high-level, but if you’re working with a graphics display, many graphics libraries already have built-in fonts. See this example, which is available in PlatformIO.

If you really want to use the FreeType library, I’ve seen two projects use the original FreeType source code in an ESP32 + ESP-IDF project:

One is a port of the other. The FreeType submodule is sourced from

So you could try and create your own Arduino library for this from the source code given above. ESP-IDF and Arduino-ESP32 are compatible with each other (see topic Using esp-idf library within the Arduino Framework (ESP32)).