Commit cca1e953 authored by BogDan Vatra's avatar BogDan Vatra Committed by Daniel Teske
Browse files

Fix windows parse readelf output



Change-Id: I863b028397f8e6a57a989c1715fa601848b96b41
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent a08b1ef8
...@@ -192,6 +192,21 @@ static inline QString msgCannotFindExecutable(const QString &appPath) ...@@ -192,6 +192,21 @@ static inline QString msgCannotFindExecutable(const QString &appPath)
"built successfully and is selected in Application tab ('Run option').").arg(appPath); "built successfully and is selected in Application tab ('Run option').").arg(appPath);
} }
static void parseSharedLibs(const QByteArray &buffer, QStringList *libs)
{
#if defined(_WIN32)
QList<QByteArray> lines = buffer.trimmed().split('\r');
#else
QList<QByteArray> lines = buffer.trimmed().split('\n');
#endif
foreach (QByteArray line, lines) {
if (line.contains("(NEEDED)") && line.contains("Shared library:") ) {
const int pos = line.lastIndexOf('[') + 1;
(*libs) << QString::fromLatin1(line.mid(pos, line.length() - pos - 1));
}
}
}
void AndroidPackageCreationStep::checkRequiredLibraries() void AndroidPackageCreationStep::checkRequiredLibraries()
{ {
QProcess readelfProc; QProcess readelfProc;
...@@ -207,13 +222,7 @@ void AndroidPackageCreationStep::checkRequiredLibraries() ...@@ -207,13 +222,7 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
return; return;
} }
QStringList libs; QStringList libs;
QList<QByteArray> lines = readelfProc.readAll().trimmed().split('\n'); parseSharedLibs(readelfProc.readAll(), &libs);
foreach (const QByteArray &line, lines) {
if (line.contains("(NEEDED)") && line.contains("Shared library:") ) {
const int pos = line.lastIndexOf('[') + 1;
libs << QString::fromLatin1(line.mid(pos, line.length() - pos - 1));
}
}
QStringList checkedLibs = AndroidManager::qtLibs(target()); QStringList checkedLibs = AndroidManager::qtLibs(target());
QStringList requiredLibraries; QStringList requiredLibraries;
foreach (const QString &qtLib, AndroidManager::availableQtLibs(target())) { foreach (const QString &qtLib, AndroidManager::availableQtLibs(target())) {
...@@ -254,14 +263,7 @@ void AndroidPackageCreationStep::checkRequiredLibrariesForRun() ...@@ -254,14 +263,7 @@ void AndroidPackageCreationStep::checkRequiredLibrariesForRun()
return; return;
} }
QStringList libs; QStringList libs;
QList<QByteArray> lines = readelfProc.readAll().trimmed().split('\n'); parseSharedLibs(readelfProc.readAll(), &libs);
foreach (const QByteArray &line, lines) {
if (line.contains("(NEEDED)") && line.contains("Shared library:") ) {
const int pos = line.lastIndexOf('[') + 1;
libs << QString::fromLatin1(line.mid(pos, line.length() - pos - 1));
}
}
QStringList requiredLibraries; QStringList requiredLibraries;
foreach (const QString &qtLib, m_availableQtLibs) { foreach (const QString &qtLib, m_availableQtLibs) {
if (libs.contains(QLatin1String("lib") + qtLib + QLatin1String(".so")) || m_qtLibs.contains(qtLib)) if (libs.contains(QLatin1String("lib") + qtLib + QLatin1String(".so")) || m_qtLibs.contains(qtLib))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment