[education/rkward] /: Increase stack size on Windows to the value used by official R binaries.

Thomas Friedrichsmeier null at kde.org
Tue Apr 26 14:42:34 BST 2022


Git commit 1090e88a8929f67d3d5a23ff47328fe76b9ff5ed by Thomas Friedrichsmeier.
Committed on 26/04/2022 at 13:42.
Pushed by tfry into branch 'master'.

Increase stack size on Windows to the value used by official R binaries.

This fixes issues with some shiny apps.

M  +1    -0    ChangeLog
M  +10   -0    rkward/rbackend/CMakeLists.txt

https://invent.kde.org/education/rkward/commit/1090e88a8929f67d3d5a23ff47328fe76b9ff5ed

diff --git a/ChangeLog b/ChangeLog
index ed62fa82..a2cc13b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 TODOs:
 	- More tolerant handshake on Windows? Simply a matter of allowing more time?
 
+- Fixed: Windows: Issues with some shiny apps due to a too small stack size
 - "Paste special" action gains option to format as data.frame, optionally with labels
 - Add "rio"-based generic import plugin
 - Fixed: Installation from dialog would fail for R packages requiring the rkward package
diff --git a/rkward/rbackend/CMakeLists.txt b/rkward/rbackend/CMakeLists.txt
index 823d68a6..94980e0d 100644
--- a/rkward/rbackend/CMakeLists.txt
+++ b/rkward/rbackend/CMakeLists.txt
@@ -46,6 +46,16 @@ LINK_DIRECTORIES(${R_SHAREDLIBDIR})
 ADD_EXECUTABLE(rkward.rbackend ${rbackend_backend_SRCS} ${rbackend_shared_SRCS})
 ECM_MARK_NONGUI_EXECUTABLE(rkward.rbackend)
 TARGET_LINK_LIBRARIES(rkward.rbackend rkgraphicsdevice.backend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT} Qt5::Network Qt5::Core KF5::I18n)
+IF(WIN32)
+# 64MB stack size is what R itself is build with on Windows, while by default the stack size would be 1MB
+# Not sure, if 64MB is actually needed, but 1MB does cause trouble e.g. with some shiny apps.
+    IF(MSVC)
+        SET_TARGET_PROPERTIES(rkward.rbackend PROPERTIES LINK_FLAGS /STACK:64000000)
+    ELSE(MSVC)
+        SET_TARGET_PROPERTIES(rkward.rbackend PROPERTIES LINK_FLAGS -Wl,--stack,64000000)
+    ENDIF(MSVC)
+ENDIF(WIN32)
+
 IF(APPLE)
     TARGET_LINK_LIBRARIES(rkward.rbackend "-framework CoreFoundation")
     ADD_CUSTOM_COMMAND(TARGET rkward.rbackend POST_BUILD


More information about the rkward-tracker mailing list