SDL2_ttf build fails due to reliance on sdl2-config

I’m building SDL2_ttf against a static build of SDL2. In building SDL2_ttf, the SDL_LIBS variable is set based on output from the relevant copy of sdl2-config. The value of SDL_LIBS is used to set LIBS, which is passed to libtool, which ultimately generates a broken libSDL2_ttf.a that itself contains libSDL2.a :

$ ar -t libSDL2_ttf.a
__.SYMDEF
libSDL2.a
libSDL2_ttf_la-SDL_ttf.o
libSDL2_ttf_la-autofit.o
libSDL2_ttf_la-ftbase.o
libSDL2_ttf_la-ftbbox.o

The problem occurs because, when SDL is built with --enable-static –disable-shared, the generated sdl2-config --libs output includes the bare path of libSDL2.a. SDL2_ttf’s build system appears to count on this not being the case.

I tried suppressing SDL2_ttf’s usage of sdl2-config to force it to use pkg-config instead, but it insists on sdl2-config. I also tried manually setting SDL_LIBS in the SDL2_ttf configure invocation, but the value I supply is overridden.

My workaround now is to patch SDL2_ttf’s generated Makefile to remove the bare libSDL2.a filepath from the LIBS and SDL_LIBS variables before invoking make. It works, but really is something I’d prefer to avoid.

So based on my threadbare understanding of the situation, I would conjecture that there is a bug in SDL2_ttf’s build system that causes an incompatibility with --disable-shared builds of SDL2.

I posted this to the bug tracker for further review, over here.

1 Like