Bug#1039574: asc: FTBFS with libsdl1.2-compat-dev: pointless accessor for struct private_hwdata

Simon McVittie smcv at debian.org
Tue Jun 27 11:50:53 BST 2023


Source: asc
Version: 2.6.1.0-9
Severity: important
Tags: ftbfs trixie sid patch

I tried recompiling asc with libsdl1.2-compat-dev instead of
libsdl1.2-dev, in preparation for having src:sdl12-compat take over the
libsdl1.2-dev package name.

I found that asc failed to build from source in this situation:

> /bin/bash ../../../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../..   -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2 -I/usr/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -g -O2 -ffile-prefix-map=/home/smcv/tmp/asc=. -fstack-protector-strong -Wformat -Werror=format-security -std=c++11 -Wno-sign-compare -D_UNIX_ -D_SDL_ -I/usr/include/freetype2 -I/usr/include/libpng16   -DSIZE_T_not_identical_to_INT -c -o sdlmm_pixelformat.lo sdlmm_pixelformat.cpp
> In file included from sdlmm_basesurface.cpp:24:
> sdlmm_basesurface.h: In member function 'SDLmm::private_hwdata* SDLmm::BaseSurface::hwdata() const':
> sdlmm_basesurface.h:142:66: error: invalid conversion from 'void*' to 'SDLmm::private_hwdata*' [-fpermissive]
>   142 |     struct private_hwdata *hwdata() const { return GetSurface()->hwdata; }
>       |                                                    ~~~~~~~~~~~~~~^~~~~~
>       |                                                                  |
>       |                                                                  void*

This is because asc bundles a copy of a SDL 1.2 C++ binding, SDLmm, which
includes an unnecessary accessor for a private member of SDL_surface.
The member was declared as `struct private_hwdata *hwdata` in classic
SDL 1.2, but sdl12-compat simplifies this to `void *hwdata`.

This struct member is for internal use by SDL and the data structure
that it points to has no public definition, so there is no legitimate
reason for third-party code to be accessing it. I think the obvious
solution is to delete the accessor, instead of silencing the compiler
warning with a cast.

I reported this to https://github.com/libsdl-org/sdl12-compat/issues/299
but it's not clear to me whether it *should* be worked around in
sdl12-compat. If it isn't, then this bug is likely to become RC when
we are ready to make src:sdl12-compat take over libsdl1.2-dev.

Please consider the attached patch (it will need a trivial edit to
reference the bug number).

Thanks,
    smcv


More information about the Pkg-games-devel mailing list