From b5e9de73315c66ea8bfe97307c4da909589d3029 Mon Sep 17 00:00:00 2001 From: probonopd Date: Thu, 9 Nov 2017 18:53:12 +0100 Subject: [PATCH] Make ldd detect pre-existing libraries in the AppDir --- tools/linuxdeployqt/shared.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/linuxdeployqt/shared.cpp b/tools/linuxdeployqt/shared.cpp index c969587..37be2ad 100644 --- a/tools/linuxdeployqt/shared.cpp +++ b/tools/linuxdeployqt/shared.cpp @@ -239,8 +239,8 @@ bool copyFilePrintStatus(const QString &from, const QString &to) if (alwaysOwerwriteEnabled) { QFile(to).remove(); } else { - LogDebug() << QFileInfo(to).fileName() << "already deployed, skipping."; - return false; + LogDebug() << QFileInfo(to).fileName() << "already exists at target location"; + return true; } } @@ -1067,6 +1067,16 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a } else { libraryPath = QFileInfo(applicationBundle.binaryPath).dir().filePath("../lib/" + bundleLibraryDirectory); } + + /* Make ldd detect pre-existing libraries in the AppDir. + * TODO: Consider searching the AppDir for .so* files outside of libraryPath + * and warning about them not being taken into consideration */ + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QString oldPath = env.value("LD_LIBRARY_PATH"); + QString newPath = libraryPath + ":" + oldPath; // FIXME: If we use a ldd replacement, we still need to observe this path + LogDebug() << "Changed LD_LIBRARY_PATH:" << newPath; + setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1); + foreach (const QString &executable, QStringList() << applicationBundle.binaryPath << additionalExecutables) { changeIdentification("$ORIGIN/" + QFileInfo(executable).dir().relativeFilePath(libraryPath) + "/" + bundleLibraryDirectory, QFileInfo(executable).canonicalFilePath()); }