[R] 32bit application

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Wed Jun 28 17:11:33 CEST 2023


В Wed, 28 Jun 2023 13:25:21 +0530
Venky Vulpine <venkyvulpine using gmail.com> пишет:

> After running " pacman -S mingw-w64-i686-gcc", it installed 15
> packages. Then I ran the " make all recommended MULTI=32" command.
> But it still shows the same issue.

Here's what I've been able to find out.

In addition to mingw-w64-i686-gcc, you also need to install the
following packages:

mingw-w64-i686-gcc-fortran
mingw-w64-i686-bzip2
mingw-w64-i686-xz
mingw-w64-i686-pcre2
mingw-w64-i686-icu
mingw-w64-i686-curl
mingw-w64-i686-libgcrypt
mingw-w64-i686-libpng
mingw-w64-i686-libjpeg
mingw-w64-i686-libtiff

(Type pacman -Sy followed by the package names, space-separated.)

When setting the $PATH, use the following prefix instead of
x86_64-w64-mingw32.static.posix:

export PATH=/mingw32/bin:"$PATH"

This gets you most of the way to start compiling R, except there are
quite a few things that the compiler doesn't like about the code for
some reason. They can be patched around using terrible hacks, making me
wonder how this worked in the past. I also had to disable the tcltk
package because the Tcl bundle is understandably 64-bit only. Did I
forget another setting that enables 32-bit compatibility?

The resulting command line to compile R is as follows:

make MULTI=32 BUILD_TCLTK=no all recommended \
 ICU_LIBS="-licuin -licuuc -licudt -lstdc++" \
 CURL_LIBS="-lcurl -lbcrypt -lzstd -lssl -lssh2 -lgcrypt -lcrypto -lgdi32 -lz -lws2_32 -lgdi32 -lcrypt32 -lidn2 -lunistring -liconv -lgpg-error -lwldap32 -lwinmm"

And I had to apply the following patches:

Index: src/extra/intl/dcigettext.c
===================================================================
--- src/extra/intl/dcigettext.c	(revision 84610)
+++ src/extra/intl/dcigettext.c	(working copy)
@@ -157,7 +157,7 @@
 #  else
 /* This is naughty if already declared, but harmful on Win64 */
 #   ifndef _WIN64
-char *getcwd (char *, size_t);
+//char *getcwd (char *, size_t);
 #   endif
 #  endif
 # endif
Index: src/extra/trio/compat.c
===================================================================
--- src/extra/trio/compat.c	(revision 84610)
+++ src/extra/trio/compat.c	(working copy)
@@ -1,5 +1,6 @@
 /* Compatibility wrapper for R */
-#include <stdio.h>
+//#include <stdio.h>
+typedef struct FILE_ FILE;
 #include <stdlib.h>
 #include <stdarg.h>
 int trio_printf(const char *format, ...);
Index: src/gnuwin32/front-ends/graphappmain.c
===================================================================
--- src/gnuwin32/front-ends/graphappmain.c	(revision 84610)
+++ src/gnuwin32/front-ends/graphappmain.c	(working copy)
@@ -15,7 +15,7 @@
 {
     extern void AppMain(int argc, char **argv);
 
-#ifdef _W64
+#if 0
     __declspec(dllimport) extern int __argc;
     __declspec(dllimport) extern char **__argv;
 
@@ -22,11 +22,11 @@
     GA_startgraphapp(Instance, PrevInstance, CmdShow);
     AppMain(__argc, __argv);
 #else
-    __declspec(dllimport) extern int _argc;
-    __declspec(dllimport) extern char **_argv;
+    extern int __argc;
+    extern char **__argv;
 
     GA_startgraphapp(Instance, PrevInstance, CmdShow);
-    AppMain(_argc, _argv);
+    AppMain(__argc, __argv);
 #endif
     return 0;
 }
Index: src/main/main.c
===================================================================
--- src/main/main.c	(revision 84610)
+++ src/main/main.c	(working copy)
@@ -798,7 +798,7 @@
 
 extern void _invoke_watson(const wchar_t*, const wchar_t*, const wchar_t*,
     unsigned int, uintptr_t);
-
+#if 0
 static void invalid_parameter_handler_watson(
     const wchar_t* expression,
     const wchar_t* function,
@@ -809,6 +809,7 @@
     _invoke_watson(expression, function, file, line, reserved);    
 }
 #endif
+#endif
 
 void setup_Rmainloop(void)
 {
@@ -823,8 +824,10 @@
 	char *p = getenv("_R_WIN_CHECK_INVALID_PARAMETERS_");
 	if (p && StringTrue(p))
 	    _set_invalid_parameter_handler(invalid_parameter_handler_abort);
+#if 0
 	else if (p && !strcmp(p, "watson"))
 	    _set_invalid_parameter_handler(invalid_parameter_handler_watson);
+#endif
     }
 #endif
 
I don't like these patches one bit and I'm sorry to post them here, but
I did get a 32-bit R.exe in the end. It seems to install packages (from
source) and run example code successfully.

-- 
Best regards,
Ivan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Rgui_x32.png
Type: image/png
Size: 27016 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20230628/07378af6/attachment.png>


More information about the R-help mailing list