Skip to content

Commit 9a93e03

Browse files
committed
Attempt to obey pre-existing RPATHs, #52
1 parent 6d4c1d9 commit 9a93e03

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

shared/shared.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -752,10 +752,12 @@ void changeIdentification(const QString &id, const QString &binaryPath)
752752
// FIXME: Split along ":" characters, check each one, only append to LD_LIBRARY_PATH if not already there
753753
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
754754
QString oldPath = env.value("LD_LIBRARY_PATH");
755-
QString newPath = oldRpath + ":" + oldPath; // FIXME: If we use a ldd replacement, we still need to observe this path
756-
// FIXME: Directory layout might be different for system Qt; cannot assume lib/ to always be inside the Qt directory
757-
LogDebug() << "Added to LD_LIBRARY_PATH:" << newPath;
758-
setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1);
755+
if (not oldPath.contains(oldRpath)){
756+
QString newPath = oldRpath + ":" + oldPath; // FIXME: If we use a ldd replacement, we still need to observe this path
757+
// FIXME: Directory layout might be different for system Qt; cannot assume lib/ to always be inside the Qt directory
758+
LogDebug() << "Added to LD_LIBRARY_PATH:" << newPath;
759+
setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1);
760+
}
759761
}
760762
LogNormal() << "Changing rpath in" << binaryPath << "to" << id;
761763
runPatchelf(QStringList() << "--set-rpath" << id << binaryPath);

0 commit comments

Comments
 (0)