DEV Community

Tony Colston
Tony Colston

Posted on

compiling SDL2_ttf on a raspberry pi

I was trying to get love2d to compile on a Raspberry pi 3+ and kept getting errors trying to build SDL2_ttf-2.0.14

Mainly it could not find freetype2

I did not want to mess up or change to much from what comes by default on the Raspberry Pi so ran this command to see what freetype I should use

dpkg -l | grep freetype
Enter fullscreen mode Exit fullscreen mode

From that I came up with the correct version of freetype. In hindsight I am not sure that really mattered. Maybe as long as my version of SDL2_ttf will link it does not matter which freetype I use?

wget -c https://download.savannah.gnu.org/releases/freetype/freetype-2.9.1.tar.bz2
Enter fullscreen mode Exit fullscreen mode

Then I did the normal configure, make, and make install dance as you would expect to build that.

That still did not seem to help my SDL ttf build. So I read the config.log file and found the build was really looking for a utility script named freetype-config. Armed with this knowledge I started looking on disk for that file and found it in the build directory. WOOOO!

/home/pi/code/freetype-2.9.1/builds/unix/freetype-config
Enter fullscreen mode Exit fullscreen mode

At this point I put that directory on my PATH and could get further in the SDL ttf build.

All the other instructions I followed are here on this great page: https://choccyhobnob.com/sdl2-2-0-8-on-raspberry-pi/

Top comments (0)