DEV Community

Tony Colston
Tony Colston

Posted on

2 1

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/

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay