From 07ec75fa3596a5ae61ac0d36468dac73fa992dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Petter=20Sk=C3=A5lerud?= Date: Tue, 17 Mar 2026 10:12:34 +0100 Subject: [PATCH] FFmpeg, Android: Use llvm-readelf In the current Android FFmpeg provisioning, we rely on the tool 'readelf' to be installed on the host. On macOS we currently pull this tool through the Homebrew 'binutils' package. This has proven unreliable on older macOS hosts. The Android NDK provides the same tool under the name 'llvm-readelf'. This patch makes us rely on this tool during provisioning, which is guaranteed to be provided. Pick-to: 6.11 Change-Id: I47a186d2dd4b442929b82f35b4d257d011cb9d10 Reviewed-by: Artem Dyomin Reviewed-by: Dimitrios Apostolou Reviewed-by: Tero Heikkinen --- .../common/shared/fix_ffmpeg_dependencies.sh | 28 ++++++++++--------- .../common/unix/install-ffmpeg-android.sh | 10 +++++-- .../qtci-macos-12-x86_64/27-binutils.sh | 10 ------- .../qtci-macos-13-x86_64/27-binutils.sh | 10 ------- .../qtci-macos-14-arm/27-binutils.sh | 9 ------ .../qtci-macos-14-x86_64/27-binutils.sh | 9 ------ .../qtci-macos-15-x86_64/27-binutils.sh | 9 ------ .../qtci-macos-26-x86_64/27-binutils.sh | 9 ------ 8 files changed, 23 insertions(+), 71 deletions(-) delete mode 100755 coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh delete mode 100755 coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh delete mode 100755 coin/provisioning/qtci-macos-14-arm/27-binutils.sh delete mode 100755 coin/provisioning/qtci-macos-14-x86_64/27-binutils.sh delete mode 100755 coin/provisioning/qtci-macos-15-x86_64/27-binutils.sh delete mode 100755 coin/provisioning/qtci-macos-26-x86_64/27-binutils.sh diff --git a/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh b/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh index 3701794a..1b4dc12b 100755 --- a/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh +++ b/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh @@ -8,25 +8,27 @@ lib_dir="$1/lib" additional_suffix="${2:-}" set_rpath="${3:-yes}" page_size="${4:-}" +custom_readelf="${5:-""}" -# readelf and patchelf are prerequisite tools for this script. Check -# that they are available. -if [ "$(uname -s)" = "Darwin" ]; then - # Under Homebrew, binutils package is not symlinked into PATH. - # This lets us use readelf provided by Homebrew. - readelf_homebrew_path="$(brew --prefix binutils)/bin/readelf" - if [[ ! -x "$readelf_homebrew_path" ]]; then - echo "Found no valid readelf executable. It is possible it was not correctly installed through Homebrew." +# If custom_readelf is not provided, we fallback to host readelf. +if [ -n "$custom_readelf" ]; then + if ! command -v "$custom_readelf"; then + echo "Error. Provided readelf executable '${custom_readelf}' is not a valid executable" exit 1 fi - readelf() { "$readelf_homebrew_path" "$@"; } -fi - -if ! command -v readelf; then +elif ! command -v readelf; then echo "Found no valid readelf command. It is possible it was not correctly installed." exit 1 fi +readelf_wrapper() { + if [ -n "$custom_readelf" ]; then + "$custom_readelf" "$@" + else + readelf "$@" + fi +} + if ! command -v patchelf; then echo "Found no valid patchelf command. It is possible it was not correctly installed." exit 1 @@ -57,7 +59,7 @@ for lib_name in "${ffmpeg_libs[@]}"; do fi read_needed_deps() { - readelf -d "$lib_path" | grep '(NEEDED)' + readelf_wrapper -d "$lib_path" | grep '(NEEDED)' } while read -r line; do diff --git a/coin/provisioning/common/unix/install-ffmpeg-android.sh b/coin/provisioning/common/unix/install-ffmpeg-android.sh index 253dc506..5158247b 100755 --- a/coin/provisioning/common/unix/install-ffmpeg-android.sh +++ b/coin/provisioning/common/unix/install-ffmpeg-android.sh @@ -124,8 +124,14 @@ build_ffmpeg_android() { if [ $page_size == "use_16kb_page_size" ]; then page_size_arg="16384" fi - - sudo "${fix_dependencies}" "${target_dir}" "${libs_prefix}" "no" "$page_size_arg" + local set_rpath_arg="no" + local readelf_path_arg="${toolchain_bin}/llvm-readelf" + sudo "$fix_dependencies" \ + "$target_dir" \ + "$libs_prefix" \ + "$set_rpath_arg" \ + "$page_size_arg" \ + "$readelf_path_arg" fi } diff --git a/coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh deleted file mode 100755 index 04d3c5bf..00000000 --- a/coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -#Copyright (C) 2024 The Qt Company Ltd -#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -set -ex - -# binutlis is installed with an error: The formula built, but is not symlinked into /usr/local -# To avoid stopping the configuration due to this problem, "|| true" is added. -brew install binutils || true - diff --git a/coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh deleted file mode 100755 index 04d3c5bf..00000000 --- a/coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -#Copyright (C) 2024 The Qt Company Ltd -#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -set -ex - -# binutlis is installed with an error: The formula built, but is not symlinked into /usr/local -# To avoid stopping the configuration due to this problem, "|| true" is added. -brew install binutils || true - diff --git a/coin/provisioning/qtci-macos-14-arm/27-binutils.sh b/coin/provisioning/qtci-macos-14-arm/27-binutils.sh deleted file mode 100755 index c4c74e7b..00000000 --- a/coin/provisioning/qtci-macos-14-arm/27-binutils.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -#Copyright (C) 2025 The Qt Company Ltd -#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -set -ex - -# binutils is installed with an error: The formula built, but is not symlinked into /usr/local -# To avoid stopping the configuration due to this problem, "|| true" is added. -brew install binutils || true diff --git a/coin/provisioning/qtci-macos-14-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-14-x86_64/27-binutils.sh deleted file mode 100755 index c4c74e7b..00000000 --- a/coin/provisioning/qtci-macos-14-x86_64/27-binutils.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -#Copyright (C) 2025 The Qt Company Ltd -#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -set -ex - -# binutils is installed with an error: The formula built, but is not symlinked into /usr/local -# To avoid stopping the configuration due to this problem, "|| true" is added. -brew install binutils || true diff --git a/coin/provisioning/qtci-macos-15-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-15-x86_64/27-binutils.sh deleted file mode 100755 index c4c74e7b..00000000 --- a/coin/provisioning/qtci-macos-15-x86_64/27-binutils.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -#Copyright (C) 2025 The Qt Company Ltd -#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -set -ex - -# binutils is installed with an error: The formula built, but is not symlinked into /usr/local -# To avoid stopping the configuration due to this problem, "|| true" is added. -brew install binutils || true diff --git a/coin/provisioning/qtci-macos-26-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-26-x86_64/27-binutils.sh deleted file mode 100755 index c4c74e7b..00000000 --- a/coin/provisioning/qtci-macos-26-x86_64/27-binutils.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -#Copyright (C) 2025 The Qt Company Ltd -#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -set -ex - -# binutils is installed with an error: The formula built, but is not symlinked into /usr/local -# To avoid stopping the configuration due to this problem, "|| true" is added. -brew install binutils || true