On Sun, 30 Sep 2018 at 15:54:05 +0100, Simon McVittie wrote: > For the short term, I'm preparing a NMU that reverts the multiarch change > and adds an autopkgtest that confirms that the package is usable, because > libsdl2-dev is currently unusable, and that's a considerably worse bug > than not being multiarch-friendly.
I have done this, so I'm moving this discussion to #909740. (Adrian, please let us know if you'd like to be removed from Cc now that SDL2 should have stopped causing FTBFSs.) > After that, I think it would make most sense for the SDL maintainer > team to choose one of the working approaches to multiarch, check that > it does in fact work, and use it to re-close the multiarch bug. I attach a possible patch for one of the proposed approaches (the forwarding header that I suggested). I have confirmed that this does not break compilation of a SDL2 game engine (I used ioquake3) and the autopkgtest added in my NMU passes. I haven't done a "full stack" test of cross-compilation yet, but it's symmetrical across architectures, so hopefully it should work: $ x86_64-linux-gnu-pkg-config --cflags --libs sdl2 -D_REENTRANT -I/usr/include/SDL2 -lSDL2 $ i686-linux-gnu-pkg-config --cflags --libs sdl2 -D_REENTRANT -I/usr/include/SDL2 -lSDL2 $ sdl2-config --cflags --libs -I/usr/include/SDL2 -D_REENTRANT -lSDL2 $ CC='gcc -m32' sdl2-config --cflags --libs -I/usr/include/SDL2 -D_REENTRANT -lSDL2 Also available here: https://salsa.debian.org/smcv/libsdl2/commits/multiarch-forwarding-header I prefer this approach because it's relatively self-contained, and doesn't require us to carry non-upstreamable patches to upstream code or rely on a relatively obscure Debian-specific compiler option. The alternative would be to modify the build system so that at least SDL_config.h (and possibly all the headers) are in /usr/include/<triplet>/SDL2, arrange for the pkg-config metadata to include -I/usr/include/<triplet>/SDL2 (and possibly /usr/include/SDL2) in the Cflags, and arrange for sdl2-config to output the same CFLAGS as <triplet>-pkg-config without itself having architecture-varying content, most likely by using a `cc -print-multiarch` trick similar to the one Hugh suggested. I started to prototype a patch for that myself, but it quickly becomes fairly ugly: for example, Hugh's patch from <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909778#64> is not sufficient, because sdl2.pc will still contain only the non-multiarch @includedir@, unless SDL2 is configured with --includedir=/usr/include/${DEB_HOST_MULTIARCH}, in which case sdl2-config will need a different patch to make it non-architecture-varying. As a result, I'm leaving it to someone who advocates this approach to prepare a candidate patch for it if they want to. If someone would prefer this approach, please put together a complete, tested patch that passes at least these tests: * libsdl2-dev:amd64 and libsdl2-dev:i386 are co-installable * the debian/tests/build autopkgtest passes * x86_64-linux-gnu-pkg-config --cflags --libs sdl2, i686-linux-gnu-pkg-config --cflags --libs sdl2 and sdl2-config --cflags --libs give reasonable results * if using Hugh's approach with $CC, "CC=i686-linux-gnu-cc sdl2-config --cflags --libs" and "CC='gcc -m32' sdl2-config --cflags --libs" also give reasonable results and preferably also test "full stack" cross-compilation of some SDL2 application or game. SDL2 maintainers: Before releasing a version of SDL2 with *anyone's* patch applied - including mine! - please make sure that you have tested it thoroughly, and in particular successfully compiled and run at least one SDL2 application or game against it. You should also consider applying Helmut's patch from #907711, which is on a similar theme (enabling cross-compilation) and seems correct and upstreamable (but please note that I haven't actually tested it). smcv
>From db7d3e2dc883e44f1305c9c61a334502b40e9f7b Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Sun, 30 Sep 2018 15:17:47 +0100 Subject: [PATCH] Make libsdl2-dev Multi-Arch: same, with working <SDL_config.h> Fix inclusion of <SDL_config.h> by installing a Debian-specific forwarding header that includes an appropriate architecture-specific copy of SDL_config.h. Closes: #909740 --- debian/SDL_config.h | 4 ++++ debian/changelog | 9 +++++++++ debian/control | 1 + debian/libsdl2-dev.install | 2 ++ debian/rules | 5 +++++ 5 files changed, 21 insertions(+) create mode 100644 debian/SDL_config.h diff --git a/debian/SDL_config.h b/debian/SDL_config.h new file mode 100644 index 0000000..bbad0f5 --- /dev/null +++ b/debian/SDL_config.h @@ -0,0 +1,4 @@ +/* Debian-specific indirection to an architecture-specific copy of + * SDL_config.h in one of the compiler's default include directories. + * Please do not include _real_SDL_config.h directly. */ +#include <SDL2/_real_SDL_config.h> diff --git a/debian/changelog b/debian/changelog index 51774eb..c8454ae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +libsdl2 (2.0.8+dfsg1-3.2) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix inclusion of <SDL_config.h> by installing a Debian-specific + forwarding header that includes an appropriate architecture-specific + copy of SDL_config.h (Closes: #909778) + + -- Simon McVittie <s...@debian.org> Sun, 30 Sep 2018 17:38:38 +0100 + libsdl2 (2.0.8+dfsg1-3.1) unstable; urgency=medium * Non-maintainer upload. diff --git a/debian/control b/debian/control index c967653..4674513 100644 --- a/debian/control +++ b/debian/control @@ -66,6 +66,7 @@ Description: Simple DirectMedia Layer Package: libsdl2-dev Section: libdevel Architecture: any +Multi-Arch: same Depends: libasound2-dev [linux-any], libdbus-1-dev, diff --git a/debian/libsdl2-dev.install b/debian/libsdl2-dev.install index d7d0549..0553a9a 100644 --- a/debian/libsdl2-dev.install +++ b/debian/libsdl2-dev.install @@ -1,4 +1,6 @@ +debian/SDL_config.h usr/include/SDL2 usr/bin/sdl2-config +usr/include/*/SDL2 usr/include/SDL2 usr/lib/*/cmake/SDL2/sdl2-config.cmake usr/lib/*/libSDL2*.so diff --git a/debian/rules b/debian/rules index 6bfbf57..d5dadab 100755 --- a/debian/rules +++ b/debian/rules @@ -69,6 +69,11 @@ override_dh_auto_clean-indep: rm -f debian/examples.tar.gz rm -rf output +override_dh_install: + mkdir -p debian/tmp/usr/include/$(DEB_HOST_MULTIARCH)/SDL2 + mv debian/tmp/usr/include/SDL2/SDL_config.h debian/tmp/usr/include/$(DEB_HOST_MULTIARCH)/SDL2/_real_SDL_config.h + dh_install + override_dh_missing: dh_missing --fail-missing -XlibSDL2.la -XlibSDL2main.la -XlibSDL2_test.la -- 2.19.0