Android: fix manual deployment with ANDROID_DEPLOYMENT_DEPENDENCIES

Fix the qtforandroid (i.e. libplugins_platforms_qtforandroid) check
and avoid calling llvm-readobj on non-library files and only add them
to the dependency list.

Task-number: QTBUG-94232
Pick-to: 6.2 6.5
Change-Id: Id1a415b6d9834daaf5337e9bd15e7daf69fd574f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
Assam Boudjelthia 2023-03-21 21:22:13 +02:00
parent b92854aed3
commit 4521dfe75a

View File

@ -1240,12 +1240,24 @@ bool readInputFile(Options *options)
}
}
} else {
auto arch = fileArchitecture(*options, path);
if (!arch.isEmpty()) {
options->qtDependencies[arch].append(QtDependency(dependency.toString(), path));
} else if (options->verbose) {
fprintf(stderr, "Skipping \"%s\", unknown architecture\n", qPrintable(path));
fflush(stderr);
auto qtDependency = [options](const QStringView &dependency,
const QString &arch) {
const auto installDir = options->architectures[arch].qtInstallDirectory;
const auto absolutePath = "%1/%2"_L1.arg(installDir, dependency.toString());
return QtDependency(dependency.toString(), absolutePath);
};
if (dependency.endsWith(QLatin1String(".so"))) {
auto arch = fileArchitecture(*options, path);
if (!arch.isEmpty()) {
options->qtDependencies[arch].append(qtDependency(dependency, arch));
} else if (options->verbose) {
fprintf(stderr, "Skipping \"%s\", unknown architecture\n", qPrintable(path));
fflush(stderr);
}
} else {
for (auto arch : options->architectures.keys())
options->qtDependencies[arch].append(qtDependency(dependency, arch));
}
}
}
@ -1591,7 +1603,7 @@ bool updateLibsXml(Options *options)
if (localLibs.isEmpty()) {
QString plugin;
for (const QtDependency &qtDependency : options->qtDependencies[it.key()]) {
if (qtDependency.relativePath.endsWith("libqtforandroid.so"_L1))
if (qtDependency.relativePath.contains("libplugins_platforms_qtforandroid_"_L1))
plugin = qtDependency.relativePath;
if (qtDependency.relativePath.contains(
@ -1604,8 +1616,8 @@ bool updateLibsXml(Options *options)
if (plugin.isEmpty()) {
fflush(stdout);
fprintf(stderr, "No platform plugin (libqtforandroid.so) included in "
"the deployment. Make sure the app links to Qt Gui library.\n");
fprintf(stderr, "No platform plugin (libplugins_platforms_qtforandroid.so) included"
" in the deployment. Make sure the app links to Qt Gui library.\n");
fflush(stderr);
return false;
}