Package: libsdl2-dev
Version: 2.28.3+dfsg-2
Justification: sdl2-config can fail to get the proper link flags.

This used to work with both gcc and clang, but now when using clang, it
fails:

$ CC=clang-16 sdl2-config --static-libs
clang: error: unsupported option '-print-multiarch'
clang: error: no input files
/usr/lib//libSDL2.a -lm -lasound -lm -ldl -lpthread -lpulse-simple -lpulse
-pthread -lsamplerate -lX11 -lXext -lXcursor -lXi -lXfixes -lXrandr -lXss
-ldrm -lgbm -lwayland-egl -lwayland-client -lwayland-cursor -lxkbcommon
-ldecor-0 -lpthread

The reason for this failure is the fact that clang has removed support for
the -print-multiarch flag.
See:
https://github.com/llvm/llvm-project/commit/e05edb19adbfd1b24f58d583e4b5b4d742f982ee

I first tried reporting this with Ubuntu, then with SDL2 upstream, but the
source of this bug actually stems from a debian patch.

See: debian/patches/no-libdir.patch

The author of the patch states that:
"a compiler for the host architecture that supports the -print-multiarch
argument (which Debian's gcc and clang do)"

This is no longer true, as clang will not take that flag.

The SDL2 upstream will not execute the compiler to determine the library
dir. This is debian-specific (and inherited by Ubuntu.)

>From my testing, it seems that clang v 16 and above is affected.

I have produced this bug on:
Ubuntu 23.04 Lunar Lobster
Ubuntu 23.10 Mantic Minotaur

Reply via email to