From cb3e3e62dc6c94c4bb426e86d0512c377e9f98fe Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 19 Jan 2018 11:10:43 -0600 Subject: [PATCH] Move RPATH adjustment to after library bundling (#216) Libraries found with the RPATH could not be found by the bundler because the RPATH was getting changed before the bundling. --- tools/linuxdeployqt/shared.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tools/linuxdeployqt/shared.cpp b/tools/linuxdeployqt/shared.cpp index 3189299..0e15a13 100644 --- a/tools/linuxdeployqt/shared.cpp +++ b/tools/linuxdeployqt/shared.cpp @@ -1158,9 +1158,6 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a 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()); - } applicationBundle.libraryPaths = findAppLibraries(appDirPath); LogDebug() << "applicationBundle.libraryPaths:" << applicationBundle.libraryPaths; @@ -1175,17 +1172,24 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a LogDebug() << "allRPaths:" << allRPaths; QList libraries = getQtLibrariesForPaths(allBinaryPaths, appDirPath, allRPaths); + + DeploymentInfo depInfo; if (libraries.isEmpty() && !alwaysOwerwriteEnabled) { - LogWarning() << "Could not find any external Qt libraries to deploy in" << appDirPath; - LogWarning() << "Perhaps linuxdeployqt was already used on" << appDirPath << "?"; - LogWarning() << "If so, you will need to rebuild" << appDirPath << "before trying again."; - LogWarning() << "Or ldd does not find the external Qt libraries but sees the system ones."; - LogWarning() << "If so, you will need to set LD_LIBRARY_PATH to the directory containing the external Qt libraries before trying again."; - LogWarning() << "FIXME: https://github.com/probonopd/linuxdeployqt/issues/2"; - return DeploymentInfo(); + LogWarning() << "Could not find any external Qt libraries to deploy in" << appDirPath; + LogWarning() << "Perhaps linuxdeployqt was already used on" << appDirPath << "?"; + LogWarning() << "If so, you will need to rebuild" << appDirPath << "before trying again."; + LogWarning() << "Or ldd does not find the external Qt libraries but sees the system ones."; + LogWarning() << "If so, you will need to set LD_LIBRARY_PATH to the directory containing the external Qt libraries before trying again."; + LogWarning() << "FIXME: https://github.com/probonopd/linuxdeployqt/issues/2"; } else { - return deployQtLibraries(libraries, applicationBundle.path, allBinaryPaths, !additionalExecutables.isEmpty()); + depInfo = deployQtLibraries(libraries, applicationBundle.path, allBinaryPaths, !additionalExecutables.isEmpty()); } + + foreach (const QString &executable, QStringList() << applicationBundle.binaryPath << additionalExecutables) { + changeIdentification("$ORIGIN/" + QFileInfo(executable).dir().relativeFilePath(libraryPath), QFileInfo(executable).canonicalFilePath()); + } + + return depInfo; } void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath,