libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.4k stars 1.84k forks source link

Upstream GLSLang releases no longer detected by QuickBuild #16571

Open RogueScholar opened 6 months ago

RogueScholar commented 6 months ago

Beginning with GLSL v14.0.0 (released 2023-12-21), the legacy HLSL and OGLCompiler stub libraries were completed removed from the upstream buildsystem. This is causing compilations with the --enable-glslang flag explicitly set to error out after failing to locate those libraries, despite a complete and functioning GLSL installation being present on the system. Currently both Debian Unstable and Ubuntu 24.04 LTS "Noble Numbat" are shipping with GLSL ⩾14.0.0.

Expected behavior

QuickBuild tests for the presence of GLSL using the upstream linking information published with pkgconf and/or CMake. (Ironically, I believe I saw a notice in their release notes that they have also ceased supporting pkgconf and now only officially support linking through the CMake buildsystem.) Based on my cursory inspection of QuickBuild, it is brittle in this instance because it manually tests for the presence of each of the (former) GLSL constituent libraries rather than querying one of the above-mentioned tools and accepting the linker flags supplied therein. (To wit, QB test for libOGLCompiler and QB test for libHLSL)

Actual behavior

Relevant build log output from failed compilation ```console +------------------------------------------------------------------------------+ | Build environment | +------------------------------------------------------------------------------+ Kernel: Linux 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 amd64 (x86_64) Toolchain package versions: binutils_2.42-4ubuntu2 dpkg-dev_1.22.6ubuntu6 g++-13_13.2.0-23ubuntu4 gcc-13_13.2.0-23ubuntu4 libc6-dev_2.39-0ubuntu8.1 libstdc++-13-dev_13.2.0-23ubuntu4 libstdc++6_14-20240412-0ubuntu1 linux-libc-dev_6.8.0-31.31 $ /<>/configure --build=x86_64-linux-gnu --prefix=/usr --sysconfdir=/etc --bindir=/usr/games --datarootdir=/usr/share --docdir=/usr/share/doc/retroarch --mandir=/usr/share/man --enable-al \ --enable-alsa --disable-audioio --enable-blissbox --disable-builtinbearssl --disable-builtinflac --disable-builtinglslang --disable-builtinmbedtls --disable-builtinzlib --enable-caca --enable-cdrom \ --enable-check --enable-command --disable-core_info_cache --disable-coreaudio --disable-d3d9 --disable-d3dx --enable-dbus --disable-dinput --enable-dr_mp3 --disable-dsound --enable-dylib --disable-dynamic_egl \ --enable-egl --enable-ffmpeg --enable-flac --enable-freetype --disable-gdi --enable-glslang --enable-hid --enable-jack --enable-kms --enable-libdecor --enable-libusb --enable-lua --enable-materialui \ --enable-memfd_create --enable-mmap --disable-mpv --enable-networkgamepad --enable-networking --disable-nvda --enable-opengl --disable-osmesa --disable-oss --enable-ozone --enable-parport --enable-plain_drm \ --enable-pulse --enable-qt --enable-rgui --disable-roar --disable-rsound --disable-sdl --enable-sdl2 --enable-sixel --enable-slang --enable-spirv_cross --enable-ssa --enable-ssl --enable-systemd \ --enable-systemmbedtls --enable-threads --enable-thread_storage --disable-tinyalsa --enable-udev --enable-v4l2 --disable-vg --disable-videocore --enable-videoprocessor --enable-vulkan --disable-wasapi \ --enable-wayland --disable-winmm --disable-winrawinput --enable-x11 --disable-xaudio --enable-xdelta --enable-xinerama --enable-xmb --enable-xrandr --enable-xshm --enable-xvideo --enable-zlib \ --enable-cg --disable-opengles --disable-rpiled --enable-sse Checking for suitable working C compiler ... /usr/bin/gcc works Checking for suitable working C++ compiler ... /usr/bin/g++ works Checking for pkg-config ... /usr/bin/pkgconf … Checking presence of header file glslang/SPIRV/GlslangToSpv.h ... yes Checking existence of -lglslang ... yes Checking existence of -lOSDependent ... yes Checking existence of -lOGLCompiler ... no Checking existence of -lMachineIndependent ... yes Checking existence of -lGenericCodeGen ... yes Checking existence of -lHLSL ... no Checking existence of -lSPIRV ... yes Checking existence of -lSPIRV-Tools-opt ... yes Checking existence of -lSPIRV-Tools ... yes Notice: System glslang libraries not found, disabling glslang support. Error: glslang is disabled and forced to build with slang support. … ERROR: /<>/configure subprocess returned exit status 2. -------------------------------------------------------------------------------- ```

Steps to reproduce the bug

  1. Prepare a RetroArch build environment on Debian Sid or Ubuntu 24.04 LTS "Noble Numbat."
  2. Verify that the appropriate packages needed to link RetroArch to GLSL are installed prior to configuring the build system (i.e. [sudo] apt -y install glslang-dev).
  3. Make the RetroArch source tree your working directory and invoke the configure script with the flag --enable-glslang.

Version/Commit

Environment information

keithbowes commented 1 month ago

Additionally, the glslang README indicates that the GenericCodeGen, MachineIndependent, OSDependent, and SPIRV libraries are currently empty stubs and will be removed in future versions as well. I have no idea of the best way to solve this, as just removing linking to these libraries will break against older glslang versions (as the glslang version included in the stable version of the distro I use).

Of course, this would all be easy if glslang had just added the glslang.pc file to upstream years ago. A lot of distros have a glslang.pc file, but it's not part of the upstream glslang. Detecting it by CMake might be possible; it isn't possible via the command line (cmake --find-package -DNAME=glslang) but you might be able to create a CMakeLists.txt file to test for it. I guess you could also do something like glslangValidator --version | head -n1 | cut -d: -f3 | cut -d. -f 1, but that depends on the output format of glslangValidator --version not changing.