Bug#951087: libsdl2-dev: Packages that embed FindSDL2.cmake fail to find SDL2

Hugh McMaster hugh.mcmaster at outlook.com
Wed Feb 19 10:13:04 GMT 2020


Hi Simon,

On Tue, 11 Feb 2020 at 20:32, Simon McVittie wrote:
> Reproducer attached. I think this is a regression in SDL2 with #909740.

Regression is perhaps too strong a word. This is more of a side effect
of a poorly implemented macro.

> Since SDL 2.0.6, the recommended way to link to a system copy of SDL2
> from a CMake project is to behave like debian/tests/cmake-example
> in the current package - use find_package(SDL2) without a FindSDL2
> macro. However, not all upstream projects that build using CMake have
> caught up with this yet. The reproducer for this bug adds a
> debian/tests/cmake-findsdl2 that represents this.
>
> The specific implementation of FindSDL2 in the reproducer
> was taken from openjk, but it's regularly copied around, and
> can be found in hedgewars, spring and many other packages:

> The solution I originally proposed for #909740 back in 2018 (MR !3) does
> not appear to suffer from this issue, but the alternatives I implemented
> in 2019 in response to reluctance to apply !3 (MRs !4 and !5) do suffer
> from it, and !5 is the implementation that was chosen for application in
> the end.

codesearch.d.o shows 28 packages contain that macro. Having said that,
I don't believe we should cater for every possible variation of SDL
detection script. The FindSDL2 macro clearly has limitations and
should be disabled in those packages. Lintian could even warn about
such use.

> I think the best solution for this is to
> revert !5 and go back to !3. Please consider
> <https://salsa.debian.org/sdl-team/libsdl2/merge_requests/3>.

All in all, I'm not in favour of reverting !5. (Okay, I'm not the
maintainer, so it's not my decision...)

> Or if you have other ideas for fixing this, I'm open to suggestions.
> I would recommend making sure that the new autopkgtest coverage passes.

I need to look into this more closely.

Hugh



More information about the Pkg-sdl-maintainers mailing list