From 371343baedc18f852f535357cd857ccc36fc43d2 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Mon, 3 Sep 2018 21:07:43 +0200 Subject: [PATCH] Properly set rpath in existing files --- src/core/appdir.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/appdir.cpp b/src/core/appdir.cpp index f0ba0ad..2d7c1b2 100644 --- a/src/core/appdir.cpp +++ b/src/core/appdir.cpp @@ -820,7 +820,21 @@ namespace linuxdeploy { if (!d->deployElfDependencies(executable)) return false; - d->setElfRPathOperations[executable] = "$ORIGIN/../lib"; + const auto systemElfClass = elf::ElfFile::getSystemElfClass(); + const auto elfClass = elf::ElfFile(executable).getElfClass(); + + std::string libSuffix = ""; + + if (systemElfClass != elfClass) { + if (elfClass == ELFCLASS32) + libSuffix = "32"; + else + libSuffix = "64"; + } + + std::string rpath = "$ORIGIN/../lib" + libSuffix; + + d->setElfRPathOperations[executable] = rpath; } for (const auto& sharedLibrary : listSharedLibraries()) {