Compare commits

...

3 Commits

Author SHA1 Message Date
Elias Toivola
ffc15eb35f Android FFmpeg: Further fix FFmpeg build directories
This fixes "does not exist" errors when trying to build multiple NDKs.

This amends 303b4c13dc

Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTQAINFRA-7069
Change-Id: I29f5cd85ffb3cf12a81b5816a5601ea37446042d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-08-31 17:38:48 +03:00
Nils Petter Skålerud
61046109cf macOS, FFmpeg: Don't use patchelf 0.18 for Android FFmpeg patching
At the time of writing, homebrew ships patchelf version 0.18.0. This
version of patchelf has a bug specific to Androd binaries. The macOS
14 arm64 host currently uses this version of patchelf. This causes an
issue during runtime linking in Qt Multimedia applications on Android.

This patch modifies the macOS 14 arm64 host to use patchelf v0.17.2
that we compile from source. It also adds warnings to the provisioning
log should someone try to use v0.18.0 in the future.

Fixes: QTBUG-136930
Pick-to: 6.10 6.9 6.8
Change-Id: Id66b560e6a1d4300a54017e9c3366720dc291944
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2025-08-31 16:38:39 +02:00
Nils Petter Skålerud
7f416abf32 FFmpeg, Android ARMv7: Use correct build folder when fixing deps
This patch amends 133de012af95507ac485845d8de8f58da005df64.

The previous patch introduced a regression where the newer build paths
were not being passed correctly into 'fix_ffmpeg_dependencies.sh'
during FFmpeg Android builds.

This patch introduces a common function to resolve the installation
directory, which is then used both during compilation and during
FFmpeg patching.

Additionally, it introduces some basic error-handling when running
'fix_ffmpeg_dependencies.sh' so that we can catch this issue in
integration, in the future.

Pick-to: 6.10
Fixes: QTBUG-138615
Change-Id: I195ebd3034a3184bad32e75916a41a20838b2db1
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-08-31 16:38:36 +02:00
5 changed files with 72 additions and 13 deletions

View File

@@ -31,6 +31,12 @@ if ! command -v patchelf; then
exit 1
fi
# Get patchelf version
patchelf_version=$(patchelf --version 2>/dev/null | awk '{print $2}')
if [[ "$patchelf_version" == "0.18.0" ]]; then
echo "WARNING: patchelf version 0.18.0 is known to have issues with Android." >&2
fi
ffmpeg_libs=("avcodec" "avdevice" "avfilter" "avformat" "avutil" "swresample" "swscale")
stub_prefix="Qt6FFmpegStub-"

View File

@@ -146,19 +146,19 @@ fi
assert_envvar_is_populated_dir "ANDROID_NDK_ROOT_LATEST"
assert_envvar_is_populated_dir "OPENSSL_ANDROID_HOME_LATEST"
build_ffmpeg_android "$target_arch" "$target_dir" "$ANDROID_NDK_ROOT_LATEST" "$OPENSSL_ANDROID_HOME_LATEST"
set_ffmpeg_dir_env_var "$envvar_latest" "$target_dir"
build_ffmpeg_android "$target_arch" "$target_dir/latest" "$ANDROID_NDK_ROOT_LATEST" "$OPENSSL_ANDROID_HOME_LATEST"
set_ffmpeg_dir_env_var "$envvar_latest" "$target_dir/latest"
if [ "${ANDROID_NDK_ROOT_NIGHTLY1}" ]; then
assert_envvar_is_populated_dir "ANDROID_NDK_ROOT_NIGHTLY1"
assert_envvar_is_populated_dir "OPENSSL_ANDROID_HOME_NIGHTLY1"
build_ffmpeg_android "$target_arch" "$target_dir" "$ANDROID_NDK_ROOT_NIGHTLY1" "$OPENSSL_ANDROID_HOME_NIGHTLY1"
build_ffmpeg_android "$target_arch" "$target_dir/nightly1" "$ANDROID_NDK_ROOT_NIGHTLY1" "$OPENSSL_ANDROID_HOME_NIGHTLY1"
set_ffmpeg_dir_env_var "$envvar_nightly1" "$target_dir/nightly1"
fi
if [ "${ANDROID_NDK_ROOT_NIGHTLY2}" ]; then
assert_envvar_is_populated_dir "ANDROID_NDK_ROOT_NIGHTLY2"
assert_envvar_is_populated_dir "OPENSSL_ANDROID_HOME_NIGHTLY2"
build_ffmpeg_android "$target_arch" "$target_dir" "$ANDROID_NDK_ROOT_NIGHTLY2" "$OPENSSL_ANDROID_HOME_NIGHTLY2"
build_ffmpeg_android "$target_arch" "$target_dir/nightly2" "$ANDROID_NDK_ROOT_NIGHTLY2" "$OPENSSL_ANDROID_HOME_NIGHTLY2"
set_ffmpeg_dir_env_var "$envvar_nightly2" "$target_dir/nightly2"
fi

View File

@@ -5,6 +5,7 @@
source "${BASH_SOURCE%/*}/../unix/InstallFromCompressedFileFromURL.sh"
# version 0.18.0 doesn't work correctly for Android binaries, so we use 0.17.2
# See patchelf bugreport: https://github.com/NixOS/patchelf/issues/576.
patchelf_version="0.17.2"
url_cached="https://ci-files01-hki.ci.qt.io/input/android/patchelf/$patchelf_version.tar.gz"

View File

@@ -30,6 +30,52 @@ function GetFfmpegDefaultConfiguration {
return $defaultConfiguration
}
# Returns the absolute installation path of FFmpeg for this build
# variant.
function ResolveFFmpegInstallDir {
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$buildSystem,
[Parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[string]$ndkVer
)
if ($ndkVer) {
$prefix = "installed-ndk-$ndkVer"
} else {
$prefix = "installed"
}
return "C:\$ffmpeg_name\build\$buildSystem\$prefix"
}
# Returns the absolute installation path of FFmpeg for this build
# variant. Returns a path that is compatible with MSYS.
#
# TODO: There is some code duplications here. Make a helper function
# that translates native Windows paths into MSYS compatible paths.
function ResolveFFmpegInstallDirMsys {
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$buildSystem,
[Parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[string]$ndkVer
)
if ($ndkVer) {
$prefix = "installed-ndk-$ndkVer"
} else {
$prefix = "installed"
}
return "/c/$ffmpeg_name/build/$buildSystem/$prefix"
}
function InstallFfmpeg {
Param (
[string]$config,
@@ -53,15 +99,16 @@ function InstallFfmpeg {
$env:MSYSTEM = $msystem
if ($ndk_ver) {
$prefix = "installed-ndk-$ndk_ver"
$installDir = ResolveFFmpegInstallDir -buildSystem $buildSystem -ndkVer $ndk_ver
$installDirForMsys = ResolveFFmpegInstallDirMsys -buildSystem $buildSystem -ndkVer $ndk_ver
} else {
$prefix = "installed"
$installDir = ResolveFFmpegInstallDir -buildSystem $buildSystem
$installDirForMsys = ResolveFFmpegInstallDirMsys -buildSystem $buildSystem
}
$installDir = "C:\$ffmpeg_name\build\$buildSystem\$prefix"
$cmd = "cd /c/$ffmpeg_name"
$cmd += " && mkdir -p build/$buildSystem && cd build/$buildSystem"
$cmd += " && ../../configure --prefix=$prefix $config"
$cmd += " && ../../configure --prefix=$installDirForMsys $config"
if ($toolchain) {
$cmd += " --toolchain=$toolchain"
}
@@ -191,8 +238,8 @@ function InstallAndroidArmv7 {
$config += " --extra-cflags=-I${openssl_path}/include --extra-ldflags=-L${openssl_path}/armeabi-v7a"
$config += " --strip=$strip"
$result= InstallFfmpeg -config $config -buildSystem "android-arm" -msystem "ANDROID_CLANG" -ffmpegDirEnvVar $ffmpeg_dir_android_envvar_name -shared $shared -ndk_ver $ndk_version
$buildSystem = "android-arm"
$result= InstallFfmpeg -config $config -buildSystem $buildSystem -msystem "ANDROID_CLANG" -ffmpegDirEnvVar $ffmpeg_dir_android_envvar_name -shared $shared -ndk_ver $ndk_version
Remove-Item -Path ${openssl_path}/armeabi-v7a/libcrypto.so
Remove-Item -Path ${openssl_path}/armeabi-v7a/libssl.so
@@ -218,9 +265,14 @@ function InstallAndroidArmv7 {
Start-Process -NoNewWindow -Wait -PassThru -ErrorAction Stop -FilePath $msys -ArgumentList ("-lc", "`"cd C:/patchelf-0.17.2 && ./bootstrap.sh && ./configure && make install`"")
$command = "${PSScriptRoot}/../shared/fix_ffmpeg_dependencies.sh C:/${ffmpeg_name}/build/android-arm/installed/ _armeabi-v7a no"
$installDirForMsys = ResolveFFmpegInstallDirMsys -buildSystem $buildSystem -ndkVer $ndk_version
$command = "${PSScriptRoot}/../shared/fix_ffmpeg_dependencies.sh ${installDirForMsys} _armeabi-v7a no"
$command = $command.Replace("\", "/")
Start-Process -NoNewWindow -Wait -PassThru -ErrorAction Stop -FilePath $msys -ArgumentList ("-lc", "`"$command`"")
$patchResult = Start-Process -NoNewWindow -Wait -PassThru -ErrorAction Stop -FilePath $msys -ArgumentList ("-lc", "`"$command`"")
if ($patchResult.ExitCode) {
Write-Host "fix_ffmpeg_dependencies.sh did not finish successfully"
return $false
}
return $result
}

View File

@@ -4,4 +4,4 @@
set -ex
brew install patchelf
source "${BASH_SOURCE%/*}/../common/unix/install-patchelf.sh"