From 7d24aa58bd0e47e299116d5172651891ae476af9 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 19 Oct 2024 11:12:22 -0400 Subject: [PATCH] Fix libplacebo/ffmpeg builds on NDKv26 This fixes a confusing error related to Vulkan headers when compiling libplacebo/ffmpeg - for example in mpv - specifically on Android with NDK v26. The reason for this is some misplaced Vulkan headers in this NDK, see https://github.com/android/ndk/issues/1974. But in reality we should just turn off Vulkan decode support entirely for these libraries as Google recommends not to use these extensions. --- libs/ffmpeg/ffmpeg.py | 5 +++++ libs/libplacebo/libplacebo.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/libs/ffmpeg/ffmpeg.py b/libs/ffmpeg/ffmpeg.py index a599eb3dd..904747fb2 100644 --- a/libs/ffmpeg/ffmpeg.py +++ b/libs/ffmpeg/ffmpeg.py @@ -171,6 +171,11 @@ def __init__(self, **kwargs): if self.subinfo.options.isActive("libs/x265"): self.subinfo.options.configure.args += ["--enable-libx265"] + if CraftCore.compiler.isAndroid: + # Work around https://github.com/android/ndk/issues/1974 in ndk26. + # But also Vulkan video decode isn't well supported on Android anyway. + self.subinfo.options.configure.args += ["--disable-vulkan"] + if CraftCore.compiler.isMacOS: self.subinfo.options.configure.args += ["--enable-rpath", "--install-name-dir=@rpath"] elif not CraftCore.compiler.isAndroid: diff --git a/libs/libplacebo/libplacebo.py b/libs/libplacebo/libplacebo.py index d09561c62..18c0dd93b 100644 --- a/libs/libplacebo/libplacebo.py +++ b/libs/libplacebo/libplacebo.py @@ -32,3 +32,8 @@ def __init__(self, **kwargs): super().__init__(**kwargs) self.subinfo.options.fetch.checkoutSubmodules = True self.subinfo.options.configure.args += ["-Ddemos=False"] + + if CraftCore.compiler.isAndroid: + # Work around https://github.com/android/ndk/issues/1974 in ndk26. + # But also Vulkan video decode isn't well supported on Android anyway. + self.subinfo.options.configure.args += ["-Dvulkan=disabled"]