Bug#951087: Bug#952098: trigger-rally: FTBFS: SDL_image.h:27:10: fatal error: SDL.h: No such file or directory

Simon McVittie smcv at debian.org
Sun Feb 23 18:21:45 GMT 2020


On Sun, 23 Feb 2020 at 09:03:33 +0100, Lucas Nussbaum wrote:
> During a rebuild of all packages in sid, your package failed to build
> on amd64.
> 
> > In file included from PEngine/texture.cpp:12:
> > /usr/include/SDL2/SDL_image.h:27:10: fatal error: SDL.h: No such file or directory
> >    27 | #include "SDL.h"

This bug is similar to #952066 and #952046. They're all caused by the
games assuming that they can find <SDL2/SDL.h>, <SDL2/SDL_image.h>
etc. in the compiler's default header search path, and also assuming
that they can find -lSDL2, -lSDL2_image etc. in the linker's default
library search path.

These assumptions are not really correct: games are meant to query each
library's CFLAGS and LIBS, add them to the compiler and linker command
lines respectively, and use #include <SDL.h> (and *not* <SDL2/SDL.h>,
which does not work on all OSs). In a simple Makefile-based build system
like the one in trigger-rally, that looks like this:

    PKG_CONFIG ?= pkg-config
    SDL2_CFLAGS = $(shell ${PKG_CONFIG} --cflags sdl2)
    SDL2_LIBS = $(shell ${PKG_CONFIG} --libs sdl2)
    SDL2_IMAGE_CFLAGS = $(shell ${PKG_CONFIG} --cflags SDL2_image)
    SDL2_IMAGE_LIBS = $(shell ${PKG_CONFIG} --libs SDL2_image)

    ...

    CPPFLAGS += $(DMACROS) $(INCDIRS) $(SDL2_CFLAGS) $(SDL2_IMAGE_CFLAGS)
    EXTRA_LIBS := $(SDL2_LIBS) $(SDL2_IMAGE_LIBS) -lSDL2main -lGL -lGLU -lGLEW -lphysfs -lopenal -lalut -lpthread -ltinyxml2

(trigger-rally could probably benefit from the same technique being applied
to non-SDL dependencies like openal and physfs, but that isn't immediately
necessary to solve this bug.)

Despite not really being correct, these assumptions used to
work before we modified SDL2 to be multiarch co-installable
(<https://bugs.debian.org/909740>). The alternative solution to #909740
proposed at <https://salsa.debian.org/sdl-team/libsdl2/merge_requests/3>
as a solution to <https://bugs.debian.org/951087> also breaks these
assumptions, although I think it would be possible to modify it so that
the assumptions hold again.

    smcv



More information about the Pkg-sdl-maintainers mailing list