From 9a93e030cff2cb10e9e672ebb3360d30b3099c6d Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 10 Jun 2017 22:05:26 +0000 Subject: [PATCH] Attempt to obey pre-existing RPATHs, #52 --- shared/shared.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/shared/shared.cpp b/shared/shared.cpp index 70c58dd..38fec81 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -752,10 +752,12 @@ void changeIdentification(const QString &id, const QString &binaryPath) // FIXME: Split along ":" characters, check each one, only append to LD_LIBRARY_PATH if not already there QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString oldPath = env.value("LD_LIBRARY_PATH"); - QString newPath = oldRpath + ":" + oldPath; // FIXME: If we use a ldd replacement, we still need to observe this path - // FIXME: Directory layout might be different for system Qt; cannot assume lib/ to always be inside the Qt directory - LogDebug() << "Added to LD_LIBRARY_PATH:" << newPath; - setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1); + if (not oldPath.contains(oldRpath)){ + QString newPath = oldRpath + ":" + oldPath; // FIXME: If we use a ldd replacement, we still need to observe this path + // FIXME: Directory layout might be different for system Qt; cannot assume lib/ to always be inside the Qt directory + LogDebug() << "Added to LD_LIBRARY_PATH:" << newPath; + setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1); + } } LogNormal() << "Changing rpath in" << binaryPath << "to" << id; runPatchelf(QStringList() << "--set-rpath" << id << binaryPath);