[education/rkward] rkward/rbackend: Correct path to backend lib inside MacOS bundle
Thomas Friedrichsmeier
null at kde.org
Tue Jun 25 14:18:39 BST 2024
Git commit 23466bf5cfcad2538aaf86b15b6a1d3f1e4ec6cf by Thomas Friedrichsmeier.
Committed on 25/06/2024 at 13:18.
Pushed by tfry into branch 'master'.
Correct path to backend lib inside MacOS bundle
M +3 -0 rkward/rbackend/rkfrontendtransmitter.cpp
M +2 -2 rkward/rbackend/rkrbackend_dlopen.cpp
https://invent.kde.org/education/rkward/-/commit/23466bf5cfcad2538aaf86b15b6a1d3f1e4ec6cf
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index 0d16d11fb..dc3da381b 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -225,6 +225,9 @@ void RKFrontendTransmitter::run () {
QString backend_lib = findBackendLibAtPath(QCoreApplication::applicationDirPath()); // for running directly from the build tree, but also covers windows
if (backend_lib.isEmpty()) backend_lib = findBackendLibAtPath(QCoreApplication::applicationDirPath() + "/" + REL_PATH_TO_LIB); // regular installation; rel path between bin and lib dir is calculated in cmake
if (backend_lib.isEmpty()) backend_lib = findBackendLibAtPath(QFileInfo(backend_executable).absolutePath()); // backend and lib both installed in libexec or similar
+# if defined(Q_OS_MACOS)
+ if (backend_lib.isEmpty()) backend_lib = findBackendLibAtPath(QCoreApplication::applicationDirPath() + "/../Frameworks"); // MacOS bundle: rkward in /MacOS, lib in /Framweorks
+# endif
# if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
env.append(QStringLiteral("RK_BACKEND_LIB=") + backend_lib);
# else
diff --git a/rkward/rbackend/rkrbackend_dlopen.cpp b/rkward/rbackend/rkrbackend_dlopen.cpp
index d5681a7c0..8ce83dc6a 100644
--- a/rkward/rbackend/rkrbackend_dlopen.cpp
+++ b/rkward/rbackend/rkrbackend_dlopen.cpp
@@ -40,11 +40,11 @@ auto loadlib(const char* name) {
#if defined(Win32)
auto ret = LoadLibraryA(name);
#elif 0 && defined(LM_ID_NEWLM) && !defined(__SANITIZE_ADDRESS__)
- // NOTE / TODO: with this, we get Cstack use too close to the limit when loading library(tcltk)
+ // NOTE / TODO: with this, we get Cstack use too close to the limit -> backend crash when loading library(tcltk)
// This applies even when loading RK_BACKEND_LIB with dlmopen() and libR.so with plain dlopen(), or vice-versa
auto ret = dlmopen(LM_ID_NEWLM, name, RTLD_NOW | RTLD_LOCAL);
#elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__)
- auto ret = dlopen(name, RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
+ auto ret = dlopen(name, RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND);
#else
auto ret = dlopen(name, RTLD_NOW | RTLD_LOCAL); // NOTE: RTLD_DEEPBIND or dlmopen causs runtime failure with address sanitization
#endif
More information about the rkward-tracker
mailing list