sdl2-config can fail when using clang over gcc.

Bug #2035422 reported by Bram Stolk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libsdl2 (Debian)
Fix Released
Unknown
libsdl2 (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

The following will fail:

$ CC=clang /usr/bin/sdl2-config --static-libs
clang: error: unsupported option '-print-multiarch'
clang: error: no input files
...

Whereas using gcc as compiler will work correctly:

CC=gcc /usr/bin/sdl2-config --static-libs
/usr/lib/x86_64-linux-gnu/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

This is because clang does not know the flag -print-multiarch

This makes it hard to use sdl2-config to query what flags to use when linking an SDL2 application statically.

OS: I have encountered this issue both in lunar lobster and mantic minotaur.

SDL2 version: 2.28.3+dfsg-2

Expected behaviour: no error, as in gcc case, when using clang.

$ lsb_release -rd
No LSB modules are available.
Description: Ubuntu Mantic Minotaur (development branch)
Release: 23.10

Revision history for this message
Paride Legovini (paride) wrote :

Related:

[1] https://github.com/llvm/llvm-project/commit/e05edb19adbfd1b24f58d583e4b5b4d742f982ee

This looks like a valid issue which I can reproduce locally on my Mantic system, but I am not sure the issue should be fixed in Ubuntu. Given that clang explicitly disabled support for -print-multiarch in [1], I doubt that's the right project to report this issue against.

I suggest reporting the issue against libsdl:

  https://github.com/libsdl-org/SDL/issues

and see what they think about it.

Changed in libsdl2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Bram Stolk (b-stolk) wrote (last edit ):

I reported it as a bug with SDL2, but actually, the bug stems from a Debian patch.
https://github.com/libsdl-org/SDL/issues/8244#issuecomment-1719808138

I then proceeded to file a bug with Debian, which I am unable to do from an Ubuntu machine:

  $ reportbug -B libsdl2-dev
  Ignored bogus setting for -B: libsdl2-dev
  *** ERROR: "Ubuntu" BTS is currently unsupported.

  Please use "ubuntu-bug" (from the apport package) for reporting bugs in Ubuntu.

  You can report bugs to Debian by specifying 'bts debian' in your ~/.reportbugrc
  or by passing the -B debian option on the commandline (see reportbug(1)).

I have tried sending an email bug report to debian instead. I will update w bug nr iif it makes it through the automated system.

Revision history for this message
Bram Stolk (b-stolk) wrote :
Changed in libsdl2 (Debian):
status: Unknown → Fix Released
Revision history for this message
Mitchell Dzurick (mitchdz) wrote :

I started a build with the debian patch that should fix this. Could you verify if this fixes your issue once it's done building?

https://launchpad.net/~mitchdz/+archive/ubuntu/libsdl2-mantic-multiarch

I tried it quickly in a Mantic VM and still see the issue, but I could be doing something else wrong here.

$ lxc shell m
# apt install -y libsdl2-2.0-0
# apt install -y libsdl2-dev
# apt install -y clang gcc
# CC=clang /usr/bin/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

I tried using my local build
# dpkg -i libsdl2-2.0-0_2.28.3+dfsg-2ubuntu1~mantic1_amd64.deb
# dpkg -i libsdl2-dev_2.28.3+dfsg-2ubuntu1~mantic1_amd64.deb
# CC=clang /usr/bin/sdl2-config --static-libs
clang: error: unsupported option '-print-multiarch'
clang: error: no input files
/usr/lib/x86_64-linux-gnu/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

Bryce Harrington (bryce)
Changed in libsdl2 (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Bram Stolk (b-stolk) wrote : Re: [Bug 2035422] Re: sdl2-config can fail when using clang over gcc.

$ sudo dpkg -i libsdl2-2.0-0_2.28.3+dfsg-2ubuntu1~mantic1_amd64.deb
(Reading database ... 396566 files and directories currently installed.)
Preparing to unpack libsdl2-2.0-0_2.28.3+dfsg-2ubuntu1~mantic1_amd64.deb ...
Unpacking libsdl2-2.0-0:amd64 (2.28.3+dfsg-2ubuntu1~mantic1) over
(2.28.3+dfsg-2ubuntu1~mantic1) ...
dpkg: dependency problems prevent configuration of libsdl2-2.0-0:amd64:
 libsdl2-2.0-0:amd64 depends on libc6 (>= 2.38); however:
  Version of libc6:amd64 on system is 2.37-0ubuntu2.1.

On Mon, Oct 23, 2023 at 11:36 AM Bryce Harrington <
<email address hidden>> wrote:

> ** Changed in: libsdl2 (Ubuntu)
> Status: Confirmed => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/2035422
>
> Title:
> sdl2-config can fail when using clang over gcc.
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/2035422/+subscriptions
>
>

--
Owner/Director of Game Studio Abraham Stolk Inc.
Vancouver BC, Canada
<email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.