[education/rkward] rkward/rbackend: Experimental: Try to preload libRlapack.dylib on Mac

Thomas Friedrichsmeier null at kde.org
Thu Jul 4 22:09:33 BST 2024


Git commit ab1db6b3da6ce9dcaf99864e59197f4bc8a4cbab by Thomas Friedrichsmeier.
Committed on 04/07/2024 at 21:09.
Pushed by tfry into branch 'master'.

Experimental: Try to preload libRlapack.dylib on Mac

M  +4    -0    rkward/rbackend/rkrbackend_dlopen.cpp

https://invent.kde.org/education/rkward/-/commit/ab1db6b3da6ce9dcaf99864e59197f4bc8a4cbab

diff --git a/rkward/rbackend/rkrbackend_dlopen.cpp b/rkward/rbackend/rkrbackend_dlopen.cpp
index 8ce83dc6a..06bd9a375 100644
--- a/rkward/rbackend/rkrbackend_dlopen.cpp
+++ b/rkward/rbackend/rkrbackend_dlopen.cpp
@@ -96,6 +96,10 @@ int main(int argc, char *argv[]) {
 #if defined(Win32)
 	auto r_dllinfo = loadlib("R.dll");
 #elif defined(__APPLE__)
+	// libR.dylib is not always correctly linked against libRlapack.dylib, even where needed.
+	// let's try to preload it into the global namespace
+	dlopen("libRlapack.dylib", RTLD_NOW | RTLD_GLOBAL);
+	dlopen("libRblas.dylib", RTLD_NOW | RTLD_GLOBAL);
 	auto r_dllinfo = loadlib("libR.dylib");
 #else
 	auto r_dllinfo = loadlib("libR.so");


More information about the rkward-tracker mailing list