Android: Fix plugins naming
Android 5 doesn't extract the files from libs folder unless they are prefixed with "lib". This patch sets a proper name for the plugin which will make gdb happy and it will also avoid any name clashes. If we rename the plugins when we copy them, gdb won't find them, therefore it can't load their symbols. On Android all the libs are in a single folder, so to make sure we don't have any name clashes, we are prefixing the plugin name with it's relative path to qt folder (we replace / with _). Fixes: QTBUG-78616 Change-Id: I7e0e67d65448532769d69f46b1856c029e2cf5cb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
9e59024bf8
commit
fcb78b5000
@ -55,7 +55,7 @@ INSTALLS += target
|
||||
|
||||
# Some final setup
|
||||
|
||||
TARGET = $$qt5LibraryTarget($$TARGET)
|
||||
TARGET = $$qt5LibraryTarget($$TARGET, "qml/$$TARGETPATH/")
|
||||
|
||||
load(qt_targets)
|
||||
load(qt_common)
|
||||
|
@ -21,7 +21,13 @@ defineReplace(qtLibraryTarget) {
|
||||
}
|
||||
|
||||
defineReplace(qt5LibraryTarget) {
|
||||
LIBRARY_NAME = $$qtLibraryTarget($$1)
|
||||
android {
|
||||
LIBRARY_NAME_PREFIX = $$2
|
||||
LIBRARY_NAME_PREFIX = $$replace(LIBRARY_NAME_PREFIX, "//", "/")
|
||||
LIBRARY_NAME_PREFIX = $$replace(LIBRARY_NAME_PREFIX, "/", "_")
|
||||
LIBRARY_NAME = $$LIBRARY_NAME_PREFIX$$qtLibraryTarget($$1)
|
||||
unset(LIBRARY_NAME_PREFIX)
|
||||
} else: LIBRARY_NAME = $$qtLibraryTarget($$1)
|
||||
isEmpty(QMAKE_FRAMEWORK_BUNDLE_NAME) {
|
||||
# Insert the major version of Qt in the library name
|
||||
# unless it's a framework build.
|
||||
|
@ -92,7 +92,7 @@ target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
|
||||
INSTALLS += target
|
||||
|
||||
qt_libinfix_plugins: TARGET = $$TARGET$$QT_LIBINFIX
|
||||
TARGET = $$qt5LibraryTarget($$TARGET)
|
||||
TARGET = $$qt5LibraryTarget($$TARGET, "plugins/$$PLUGIN_TYPE/")
|
||||
|
||||
CONFIG += create_cmake
|
||||
|
||||
|
@ -21,7 +21,7 @@ CONFIG += simd optimize_full
|
||||
QMAKE_DOCS = $$PWD/doc/qtcore.qdocconf
|
||||
|
||||
ANDROID_LIB_DEPENDENCIES = \
|
||||
plugins/platforms/libqtforandroid.so
|
||||
plugins/platforms/libplugins_platforms_qtforandroid.so
|
||||
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
|
||||
jar/QtAndroid.jar
|
||||
ANDROID_PERMISSIONS = \
|
||||
|
@ -209,7 +209,7 @@ void QFactoryLoader::update()
|
||||
#if defined(Q_OS_WIN)
|
||||
QStringList(QStringLiteral("*.dll")),
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
QStringList(QLatin1String("plugins_%1_*.so").arg(d->suffix)),
|
||||
QStringList(QLatin1String("libplugins_%1_*.so").arg(d->suffix)),
|
||||
#endif
|
||||
QDir::Files);
|
||||
QLibraryPrivate *library = 0;
|
||||
|
@ -26,7 +26,7 @@ qtConfig(bearermanagement) {
|
||||
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
|
||||
jar/QtAndroidBearer.jar
|
||||
ANDROID_LIB_DEPENDENCIES = \
|
||||
plugins/bearer/libqandroidbearer.so
|
||||
plugins/bearer/libplugins_bearer_qandroidbearer.so
|
||||
MODULE_PLUGIN_TYPES = \
|
||||
bearer
|
||||
ANDROID_PERMISSIONS += \
|
||||
|
@ -314,10 +314,8 @@ static QString shellQuote(const QString &arg)
|
||||
|
||||
QString architecureFromName(const QString &name)
|
||||
{
|
||||
const QFileInfo fi(name);
|
||||
const QString extractedFileName = fi.fileName();
|
||||
QRegExp architecture(QStringLiteral(".*_(.*)\\.so"));
|
||||
if (!architecture.exactMatch(extractedFileName))
|
||||
QRegExp architecture(QStringLiteral(".*_(armeabi-v7a|arm64-v8a|x86|x86_64).so"));
|
||||
if (!architecture.exactMatch(name))
|
||||
return {};
|
||||
return architecture.capturedTexts().last();
|
||||
}
|
||||
@ -1177,7 +1175,7 @@ bool copyAndroidExtraResources(Options *options)
|
||||
} else {
|
||||
if (!checkArchitecture(*options, originFile))
|
||||
continue;
|
||||
destinationFile = libsDir + QLatin1String("/lib") + QString(resourceDir.dirName() + QLatin1Char('/') + resourceFile).replace(QLatin1Char('/'), QLatin1Char('_'));
|
||||
destinationFile = libsDir + resourceFile;
|
||||
options->archExtraPlugins[options->currentArchitecture] += resourceFile;
|
||||
}
|
||||
if (!copyFileIfNewer(originFile, destinationFile, *options))
|
||||
@ -1330,9 +1328,13 @@ bool updateLibsXml(Options *options)
|
||||
if (options->verbose)
|
||||
fprintf(stdout, " -- Using platform plugin %s\n", qPrintable(plugin));
|
||||
}
|
||||
allLocalLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), localLibs.join(QLatin1Char(':'))
|
||||
.replace(QLatin1String("lib/"), QString{})
|
||||
.replace(QLatin1Char('/'), QLatin1Char('_')));
|
||||
|
||||
// remove all paths
|
||||
for (auto &lib : localLibs) {
|
||||
if (lib.endsWith(QLatin1String(".so")))
|
||||
lib = lib.mid(lib.lastIndexOf(QLatin1Char('/')) + 1);
|
||||
}
|
||||
allLocalLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), localLibs.join(QLatin1Char(':')));
|
||||
}
|
||||
|
||||
QHash<QString, QString> replacements;
|
||||
@ -2033,7 +2035,7 @@ bool copyQtFiles(Options *options)
|
||||
if (qtDependency.relativePath.startsWith(QLatin1String("lib/"))) {
|
||||
garbledFileName = qtDependency.relativePath.mid(sizeof("lib/") - 1);
|
||||
} else {
|
||||
garbledFileName = QString(qtDependency.relativePath).replace(QLatin1Char('/'), QLatin1Char('_'));
|
||||
garbledFileName = qtDependency.relativePath.mid(qtDependency.relativePath.lastIndexOf(QLatin1Char('/')) + 1);
|
||||
}
|
||||
destinationFileName = libsDirectory + options->currentArchitecture + QLatin1Char('/') + garbledFileName;
|
||||
} else if (qtDependency.relativePath.startsWith(QLatin1String("jar/"))) {
|
||||
|
Loading…
Reference in New Issue
Block a user