Skip to content

ffmpeg automatic dependency breaks the build if SDL3 happens to be installed #1165

@smcv

Description

@smcv

openal 1.24.2.

For context, Debian normally builds openal-soft in a minimal environment with only the required packages. In the configuration used by Debian, features that require SDL3, libsndfile and ffmpeg are not enabled, and development headers for those packages are not installed. It's easiest to demonstrate this by building Debian's packaged version of openal-soft 1.24.2 rather than the upstream source:

$ podman run --rm -it debian:forky-slim
# sed -i -e 's/^Types: deb/& deb-src/' /etc/apt/sources.list.d/debian.sources
# apt update
# apt full-upgrade
# apt build-dep openal-soft
# apt source openal-soft
# cd openal-soft-*
# dpkg-buildpackage
...
make[2]: Entering directory '/openal-soft-1.24.2'
dh_auto_configure -- -DCMAKE_VERBOSE_MAKEFILE=ON -DLIB_SUFFIX="/x86_64-linux-gnu" -DEXAMPLES=OFF ..
	cd build-tree && DEB_PYTHON_INSTALL_LAYOUT=deb PKG_CONFIG=/usr/bin/pkg-config cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DCMAKE_INSTALL_RUNSTATEDIR=/run -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DCMAKE_VERBOSE_MAKEFILE=ON -DLIB_SUFFIX=/x86_64-linux-gnu -DEXAMPLES=OFF .. ..
... and the build succeeds

But if I add SDL3 development files and repeat the build, it fails at the configure stage:

# apt install libsdl3-dev
# dpkg-buildpackage
...
make[2]: Entering directory '/openal-soft-1.24.2'
dh_auto_configure -- -DCMAKE_VERBOSE_MAKEFILE=ON -DLIB_SUFFIX="/x86_64-linux-gnu" -DEXAMPLES=OFF ..
	cd build-tree && DEB_PYTHON_INSTALL_LAYOUT=deb PKG_CONFIG=/usr/bin/pkg-config cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DCMAKE_INSTALL_RUNSTATEDIR=/run -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DCMAKE_VERBOSE_MAKEFILE=ON -DLIB_SUFFIX=/x86_64-linux-gnu -DEXAMPLES=OFF .. ..
...
CMake Error at cmake/FindFFmpeg.cmake:91 (file):
  file STRINGS file
  "/openal-soft-1.24.2/AVCODEC_INCLUDE_DIRS-NOTFOUND/libavcodec/version.h"
  cannot be read.
Call Stack (most recent call first):
  cmake/FindFFmpeg.cmake:132 (find_component)
  CMakeLists.txt:1320 (find_package)

This appears to be because having SDL3 makes the build system opportunistically check for ffmpeg, and cmake/FindFFmpeg.cmake does not cope gracefully with wanting ffmpeg but not finding it.

I think there are really two problems here:

  1. cmake/FindFFmpeg.cmake fails the build if ffmpeg is missing, rather than merely reporting it as not found and continuing;
  2. the "automagic dependency" on ffmpeg makes the result of a build in a non-minimal environment unpredictable, but there is no way to tell the build system that we don't want ffmpeg even if it happens to be present

Solving the second one (I'll send a merge request shortly) makes it straightforward to work around the first.

(Well, there is a third problem here, but it isn't an upstream bug: the Debian packaging is using -DEXAMPLES=OFF but that option no longer has an effect, so it should probably be updated to use -DALSOFT_EXAMPLES=OFF.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions