mirror of
git://code.qt.io/qt/qt5.git
synced 2026-04-11 07:45:59 +08:00
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 <artem.dyomin@qt.io> Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Tero Heikkinen <tero.heikkinen@qt.io>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user