[rkward] rkward/rbackend: Next attempt at fixing Mac lib resolution

Thomas Friedrichsmeier null at kde.org
Tue Dec 31 11:48:25 GMT 2019


Git commit cae22990c9a1187210902d31a9f225ee824e6f56 by Thomas Friedrichsmeier.
Committed on 31/12/2019 at 11:48.
Pushed by tfry into branch 'master'.

Next attempt at fixing Mac lib resolution

M  +10   -0    rkward/rbackend/rkfrontendtransmitter.cpp

https://commits.kde.org/rkward/cae22990c9a1187210902d31a9f225ee824e6f56

diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index d72c56aa..a78d6e9f 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -118,6 +118,16 @@ void RKFrontendTransmitter::run () {
 	if (!debugger.isEmpty ()) {
 		args = debugger.split (' ') + args;
 	}
+#ifdef Q_OS_MACOS
+	// Resolving libR.dylib and friends is a pain on MacOS, and running through R CMD does not always seem to be enough.
+	// (Apparently DYLIB_FALLBACK_LIBRARY_PATH is ignored on newer versions of MacOS). Safest best seems to be to startin the lib directory, itself.
+	// TODO fix working directory, afterwards
+	QProcess dummy;
+	dummy.start (qgetenv ("R_BINARY"), QStringList() << "--slave" << "--no-save" << "--no-init-file" << "-e" << "cat(R.home('lib'))");
+	dummy.waitForFinished ();
+	QString r_home = QString::fromLocal8Bit (dummy.readAllStandardOutput ());
+	backend->setWorkingDirectory (r_home);
+#endif
 	args.prepend ("CMD");
 	if (DL_DEBUG >= RK_Debug::RK_Debug_Level) {
 		qDebug ("%s", qPrintable (qgetenv ("R_BINARY")));



More information about the rkward-tracker mailing list