From patchwork Sun Nov 2 15:08:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 24945 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6A744BDE4C for ; Sun, 2 Nov 2025 15:08:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A76816096B; Sun, 2 Nov 2025 16:08:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nvqZXN9c"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A57ED606E6 for ; Sun, 2 Nov 2025 16:08:24 +0100 (CET) Received: from pendragon.ideasonboard.com (82-203-160-149.bb.dnainternet.fi [82.203.160.149]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 2F8DD10D4 for ; Sun, 2 Nov 2025 16:06:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1762095992; bh=dHNKDMUv9aYrD4EORLid0EFWs6cVx94OAYgyK8RClzw=; h=From:To:Subject:Date:From; b=nvqZXN9cH8k7iZxsdhMeU20NjA0JSj2YHsRswqwAtD8I9puLLovAGxn/nj3KnZ8+6 5KJ+BFNwPtl2OIEChTEbv8FAV05i/N2PHpWcJVkea2BxWPLUe2Pax1IEToFGJwDBgq IwgVd5HEi0T631h73NXpIPJhm7hhfJHVGfrv2Pqg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH v3] subprojects: libyuv: Bump to version 1922 Date: Sun, 2 Nov 2025 17:08:10 +0200 Message-ID: <20251102150810.5415-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The libyuv wrap uses a libyuv commit between versions 1770 and 1772, more than 5 years old. This specifies CMake 2.8 as the minimum required version. The most recent CMake has dropped compatibility with versions older than 3.5 in CMake 4.0. CMake 3.5 was released in 2016, and all distributions we care about ship more recent versions. With CMake 4.0 or newer, shipped for instance by Gentoo, compilation of the libyuv wrap fails. Update the wrap to version 1922, which is the latest numbered version (libyuv doesn't tag release by increases a version number in the README.chromium file). This requires CMake 3.16, released 6 years ago, and available in at least the last two LTS of major distributions. This update introduces two issues. First, due to a bug in Meson (see https://github.com/mesonbuild/meson/issues/10764), PIC handling is broken when a CMake project wraps a static library into another static library that has no additional source file. Work around it by wrapping the libyuv static library again, manually setting 'pic' to true. The second issue is that libyuv fails to compile for armhf platforms that don't support NEON instructions. This is the case on Debian 12 and 13 that ship armhf toolchains with NEON disabled by default. The issue causes CI failures. As the libyuv wrap is a convenience measure, disable NEON optimization on armfd platforms the same way Debian does in its armhf packages. If NEON support is important, the build environment should provide a suitable libyuv. Signed-off-by: Laurent Pinchart Reviewed-by: Stefan Klug Acked-by: Kieran Bingham --- This now passes CI: https://gitlab.freedesktop.org/pinchartl/libcamera/-/pipelines/1539176 Changes since v2: - Disable NEON on armhf - Update to version 1922 Changes since v1: - Update to version 1921 --- src/meson.build | 16 ++++++- subprojects/libyuv.wrap | 3 +- ...t-Do-not-enable-NEON-for-armel-armhf.patch | 42 +++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 subprojects/packagefiles/libyuv/0004-CMakeLists.txt-Do-not-enable-NEON-for-armel-armhf.patch base-commit: 760456acfc78419b61c9df01d944007c7f3f6d22 -- Regards, Laurent Pinchart diff --git a/src/meson.build b/src/meson.build index 8eb8f05b362f..9b63c8e845d8 100644 --- a/src/meson.build +++ b/src/meson.build @@ -55,7 +55,21 @@ if (pipelines.contains('virtual') or get_option('android').allowed()) and \ '-Wno-unused-parameter') libyuv_vars.append_link_args('-ljpeg') libyuv = cmake.subproject('libyuv', options : libyuv_vars) - libyuv_dep = libyuv.dependency('yuv') + + # Meson fails to apply the -fPIC flag to static libraries produced by CMake + # that wraps other static libraries without adding any source file, despite + # setting CMAKE_POSITION_INDEPENDENT_CODE to ON. See + # https://github.com/mesonbuild/meson/issues/10764. + # + # Work around the issue by wrapping the libyuv static library into another + # static library with 'pic' set to true. + libyuv_static = static_library('libyuv-static', + dependencies : libyuv.dependency('yuv'), + pic : true, + install : false) + libyuv_include = libyuv.include_directories('yuv') + libyuv_dep = declare_dependency(link_with : libyuv_static, + include_directories : libyuv_include) endif # libcamera must be built first as a dependency to the other components. diff --git a/subprojects/libyuv.wrap b/subprojects/libyuv.wrap index 3417e73f376c..e892d8a3b5c3 100644 --- a/subprojects/libyuv.wrap +++ b/subprojects/libyuv.wrap @@ -3,4 +3,5 @@ [wrap-git] directory = libyuv url = https://chromium.googlesource.com/libyuv/libyuv.git -revision = 93b1b332cd60b56ab90aea14182755e379c28a80 +revision = 500f45652c459cfccd20f83f297eb66cb7b015cb +diff_files = libyuv/0004-CMakeLists.txt-Do-not-enable-NEON-for-armel-armhf.patch diff --git a/subprojects/packagefiles/libyuv/0004-CMakeLists.txt-Do-not-enable-NEON-for-armel-armhf.patch b/subprojects/packagefiles/libyuv/0004-CMakeLists.txt-Do-not-enable-NEON-for-armel-armhf.patch new file mode 100644 index 000000000000..70cbc2c7d32b --- /dev/null +++ b/subprojects/packagefiles/libyuv/0004-CMakeLists.txt-Do-not-enable-NEON-for-armel-armhf.patch @@ -0,0 +1,42 @@ +From: Boyuan Yang +Date: Fri, 8 Nov 2024 08:07:01 -0500 +Subject: CMakeLists.txt: Do not enable NEON for armel armhf + +According to https://wiki.debian.org/ArchitectureSpecificsMemo#armel +the armhf architecture does not guarantee NEON. Do not enable NEON +on armhf. Also disable NEON for armel to prevent FTBFS +--- + CMakeLists.txt | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bf8be36..783c3d4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -95,16 +95,17 @@ endif() + if(NOT MSVC) + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" arch_lowercase) + ++# Debian-specific: Do not enable Arm Neon kernels on non-arm64 architectures. + if(arch_lowercase MATCHES "^arm" AND NOT arch_lowercase STREQUAL "arm64") +- # Enable Arm Neon kernels. +- add_definitions(-DLIBYUV_NEON=1) +- add_library(${ly_lib_name}_neon OBJECT +- ${ly_src_dir}/compare_neon.cc +- ${ly_src_dir}/rotate_neon.cc +- ${ly_src_dir}/row_neon.cc +- ${ly_src_dir}/scale_neon.cc) +- target_compile_options(${ly_lib_name}_neon PRIVATE -mfpu=neon) +- list(APPEND ly_lib_parts $) ++ message("Debian-specific: Not enabling NEON on ${arch_lowercase}.") ++# add_definitions(-DLIBYUV_NEON=1) ++# add_library(${ly_lib_name}_neon OBJECT ++# ${ly_src_dir}/compare_neon.cc ++# ${ly_src_dir}/rotate_neon.cc ++# ${ly_src_dir}/row_neon.cc ++# ${ly_src_dir}/scale_neon.cc) ++# target_compile_options(${ly_lib_name}_neon PRIVATE -mfpu=neon) ++# list(APPEND ly_lib_parts $) + endif() + + if(arch_lowercase STREQUAL "aarch64" OR arch_lowercase STREQUAL "arm64")