From 8491d03d3f266585c3d509ba2b7548d53aa8d7e5 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Tue, 21 Mar 2023 21:22:13 +0200 Subject: [PATCH] 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 Change-Id: Id1a415b6d9834daaf5337e9bd15e7daf69fd574f Reviewed-by: Ville Voutilainen (cherry picked from commit 4521dfe75ad147fc5510702b33189dd2faed93fd) Reviewed-by: Rami Potinkara --- src/tools/androiddeployqt/main.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 66f7d40b975..dfa988c013d 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -1109,12 +1109,17 @@ 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); + if (dependency.endsWith(QLatin1String(".so"))) { + 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); + } + } else { + for (auto arch : options->architectures.keys()) + options->qtDependencies[arch].append(QtDependency(dependency.toString(), path)); } } } @@ -1422,7 +1427,7 @@ bool updateLibsXml(Options *options) if (localLibs.isEmpty()) { QString plugin; for (const QtDependency &qtDependency : options->qtDependencies[it.key()]) { - if (qtDependency.relativePath.endsWith(QLatin1String("libqtforandroid.so"))) + if (qtDependency.relativePath.contains(QLatin1String("libplugins_platforms_qtforandroid_"))) plugin = qtDependency.relativePath; if (qtDependency.relativePath.contains( @@ -1435,8 +1440,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; }