Merge pull request #188 from smarttowel/fix_149

Possible fix for #149
This commit is contained in:
TheAssassin 2022-01-12 10:51:49 +01:00 committed by GitHub
commit 4c5b9c5daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -56,6 +56,18 @@ namespace linuxdeploy {
return split(s, '\n');
}
static std::string join(const std::vector<std::string> &strings, const std::string &delimiter) {
std::string result;
for (size_t i = 0; i < strings.size(); i++) {
result += strings[i];
if (i != strings.size() - 1) {
result += delimiter;
}
}
return result;
}
static inline std::string strLower(std::string s) {
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::tolower(c); });
return s;

View File

@ -834,7 +834,14 @@ namespace linuxdeploy {
if (!d->deployElfDependencies(sharedLibrary))
return false;
d->setElfRPathOperations[sharedLibrary] = "$ORIGIN";
const auto rpath = elf_file::ElfFile(sharedLibrary).getRPath();
auto rpathList = util::split(rpath, ':');
if (std::find(rpathList.begin(), rpathList.end(), "$ORIGIN") == rpathList.end()) {
rpathList.push_back("$ORIGIN");
d->setElfRPathOperations[sharedLibrary] = util::join(rpathList, ":");
} else {
d->setElfRPathOperations[sharedLibrary] = rpath;
}
}
// used to bundle dependencies of executables or libraries in the AppDir without moving them