Skip to content

Commit e62a4f4

Browse files
author
Markus Müller
committed
Existing relative RPATHs are not removed (probonopd#327)
1 parent 7749d00 commit e62a4f4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tools/linuxdeployqt/shared.cpp

+15-2
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,21 @@ void changeIdentification(const QString &id, const QString &binaryPath)
841841
setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1);
842842
}
843843
}
844-
LogNormal() << "Changing rpath in" << binaryPath << "to" << id;
845-
runPatchelf(QStringList() << "--set-rpath" << id << binaryPath);
844+
845+
QStringList rpath = oldRpath.split(":", QString::SkipEmptyParts);
846+
rpath.prepend(id);
847+
rpath.removeDuplicates();
848+
foreach(QString path, QStringList(rpath)) {
849+
// remove any non-relative path that would point outside the package
850+
if (!path.startsWith("$ORIGIN"))
851+
{
852+
LogWarning() << "Removing absolute rpath of " << path << " in " << binaryPath;
853+
rpath.removeAll(path);
854+
}
855+
}
856+
857+
LogNormal() << "Changing rpath in" << binaryPath << "to" << rpath.join(":");
858+
runPatchelf(QStringList() << "--set-rpath" << rpath.join(":") << binaryPath);
846859

847860
// qt_prfxpath:
848861
if (binaryPath.contains("libQt5Core")) {

0 commit comments

Comments
 (0)