Bug#909778: libsdl2-dev: SDL_config.h no longer in cflags provided by pkg-config/sdl2-config

Hugh McMaster hugh.mcmaster at outlook.com
Sun Sep 30 15:04:56 BST 2018

On Sunday, 30 September 2018 1:25 AM, Simon McVittie wrote:
On Sat, 29 Sep 2018 at 14:50:09 +0000, Hugh McMaster wrote:
>> I’m not able to check right now, but I believe this will cause
>> problems when libsdl2-dev is installed for a foreign architecture,
>> because sdl2-config will call pkg-config for the native architecture
>> instead. It would need to be qualified with the GNU triplet.

> Yes, that's why I didn't suggest this. For packages that (at least
> sometimes) use a foo-config script found in PATH, there's no general
> way to make the foo-config script produce different output for each
> architecture, other than perhaps something like Hugh's trick with $CC.

I'm attaching a patch showing how the trick with $CC works. It needs 
more testing.

> As a result, I was looking for ways to make that constant output work
> with multiarch.
> I think the constraints are:

> * /usr/bin/sdl2-config must contain the same bytes on all architectures
>  (because if it didn't, libsdl2-dev couldn't be Multi-Arch: foreign)
> * some header (the "config header") must contain everything that's in
>   upstream's SDL_config.h, which varies by architecture (because other
>  SDL headers need that)
>* when compiling with `sdl2-config --cflags` or `pkg-config --cflags SDL2`,
>  #include "SDL_config.h" from a different SDL2 header must result in
>  the config header being included (because they do this)

Yes, I agree with all of these statements.

> * (maybe) when compiling with `sdl2-config --cflags` or
>  `pkg-config --cflags SDL2`, #include <sdl_config.h> must result in the
>   config header being included (because apps/games might do this)

Well, it must be locatable. I don't see this as a problem, because 
SDL_config.h was previously installed in /usr/include, so it would have
been locatable then, even if it was not #included.

> * when *not* compiling with `sdl2-config --cflags` or
>  `pkg-config --cflags SDL2`, #include <sdl_config.h> should not find the
>  config header (because if it did, we would break SDL 1)

> * when cross-compiling, either `sdl2-config --cflags` or
>  `pkg-config --cflags SDL2` must result in us finding the config header
>  for the host architecture, not the build architecture
>  (I'm using Autotools/Meson terminology here)

Yes, agreed. This is our current problem.

> Are there others?

> I don't mean that /usr/include/SDL2/SDL_config.h would contain any
> #defines at all; I mean that it would be literally one comment and one
> #include (of a file that cpp will find in an architecture-dependent
> location on its default include path, which can therefore have
> architecture-dependent contents).

Right. My only concern with this solution is whether $CC will know to 
use the correct architecture-dependent location. I'm not too familiar
with how this works, so it could be fine.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sdl2-config-multiarch.patch
Type: application/octet-stream
Size: 933 bytes
Desc: sdl2-config-multiarch.patch
URL: <http://alioth-lists.debian.net/pipermail/pkg-sdl-maintainers/attachments/20180930/a1b8ddee/attachment.obj>

More information about the Pkg-sdl-maintainers mailing list