Bug#1036820: libsdl2-dev include headers not found by cmake since usr merge

Jaka smgl+debiansalsa at lynxlynx.info
Sat May 27 09:14:51 BST 2023


Package: libsdl2-dev
Version: 2.26.3+dfsg-1
Severity: normal
X-Debbugs-Cc: smgl+debiansalsa at lynxlynx.info

Dear Maintainer,

I've upgraded an old system and now one program does not build any more.
When trying to configure it via cmake:

  CMake Error at /lib/x86_64-linux-gnu/cmake/SDL2/sdl2-config.cmake:13 (message):
    File or directory //include/SDL2 referenced by variable SDL2_INCLUDE_DIR
    does not exist !
  Call Stack (most recent call first):
    /lib/x86_64-linux-gnu/cmake/SDL2/sdl2-config.cmake:29 (set_and_check)
    CMakeLists.txt:331 (find_package)

One can see "usr" is missing in the file path, since there is no /include.
On the old system the usr migration hasn't happened yet, so it worked fine,
but now cmake starts looking for its files and first considers /lib, only then
/usr/lib.

sdl2-config.cmake does a relative path lookup, so that becomes a problem:

  get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/../../../.." ABSOLUTE)

4 dirs up of /lib/x86_64-linux-gnu/cmake/SDL2/sdl2-config.cmake is /, while it
was /usr before ... Changing the cmake lookup to explicitly resolve symlinks
does not help, since only the dirs are linked, not the file it's considering.

I'm inclined to think this should be fixed in Debian, not cmake. The hackiest
solution is to just replace the line with

  set(prefix "/usr")

A bit safer would be to just do it if the previous call resolved to /, but I
don't know what all layouts are supported. If someone installed via chroot,
both ways would be broken. So a better solution would be something like: 
copy CMAKE_CURRENT_LIST_DIR to a new var, replace /lib with /usr/lib in it,
use the new var for the prefix lookup instead.

This report is against 2.26.3, but I didn't see anything relevant in the changelog
for .5, hence the report.


-- System Information:
Debian Release: bookworm/sid
  APT prefers lunar-updates
  APT policy: (500, 'lunar-updates'), (500, 'lunar-security'), (500, 'lunar')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.2.0-20-generic (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=sl_SI.UTF-8, LC_CTYPE=sl_SI.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libsdl2-dev depends on:
ii  libasound2-dev      1.2.8-1build1
ii  libdbus-1-dev       1.14.4-1ubuntu1
ii  libdecor-0-dev      0.1.1-2
ii  libdrm-dev          2.4.114-1
ii  libegl-dev          1.6.0-1
ii  libgbm-dev          23.0.2-1ubuntu1
ii  libgl-dev           1.6.0-1
ii  libgles-dev         1.6.0-1
ii  libibus-1.0-dev     1.5.28-3
ii  libpulse-dev        1:16.1+dfsg1-2ubuntu3
ii  libsamplerate0-dev  0.2.2-3
ii  libsdl2-2.0-0       2.26.3+dfsg-1
ii  libsndio-dev        1.9.0-0.3
ii  libudev-dev         252.5-2ubuntu3
ii  libwayland-dev      1.21.0-1
ii  libx11-dev          2:1.8.4-2
ii  libxcursor-dev      1:1.2.1-1
ii  libxext-dev         2:1.3.4-1build1
ii  libxfixes-dev       1:6.0.0-2
ii  libxi-dev           2:1.8-1build1
ii  libxinerama-dev     2:1.1.4-3
ii  libxkbcommon-dev    1.5.0-1
ii  libxrandr-dev       2:1.5.2-2
ii  libxss-dev          1:1.2.3-1build2
ii  libxt-dev           1:1.2.1-1
ii  libxv-dev           2:1.0.11-1.1
ii  libxxf86vm-dev      1:1.1.4-1build3

libsdl2-dev recommends no packages.

libsdl2-dev suggests no packages.

-- no debconf information



More information about the Pkg-sdl-maintainers mailing list