Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows build using Rtools libraries? #9

Open
davidcsterratt opened this issue Feb 2, 2023 · 10 comments
Open

Windows build using Rtools libraries? #9

davidcsterratt opened this issue Feb 2, 2023 · 10 comments

Comments

@davidcsterratt
Copy link

davidcsterratt commented Feb 2, 2023

I'm trying to get RGtk to build on Windows, so that I can be confident that my package Retistruct will be usable in the future for Windows users (see this issue davidcsterratt/retistruct#52).

I was wondering if it would be possible to get RGtk to build using only the libraries available in Rtools, which appear to include all the required dependencies. It would then be possible (I suppose) to get new versions compiled using the win_builder service, which might assist with getting RGtk back on CRAN.

I've been experimenting with setting up the PKG_CPPLFAGS and PKG_LIBS in Makevars.win using the output from the pkg-config that I installed into the Rtools mingw32 system using pacman:

# PKG_CONFIG_PATH=/x86_64-w64-mingw32.static.posix/lib/pkgconfig/:$PKG_CONFIG_PATH
# pkg-config.exe --static --cflags  gtk+-2.0
PKG_CPPFLAGS = -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/gtk-2.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/gtk-2.0/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/libpng16 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/atk-1.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/pango-1.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/cairo -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/gdk-pixbuf-2.0 -DPCRE_STATIC -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/harfbuzz -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/fribidi -DFRIBIDI_LIB_STATIC -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/freetype2 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/glib-2.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/glib-2.0/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/pixman-1 -pthread -mms-bitfields -D_R_=1 -DUSE_R=1 -I. -I../inst/include

#  pkg-config.exe --static --libs  gtk+-2.0
PKG_LIBS=-L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lgdk-win32-2.0 -lgtk-win32-2.0 -limm32 -lshell32 -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/../lib -lws2_32 -lws2_32 -lpangocairo-1.0 -lws2_32 -lws2_32 -lws2_32 -lws2_32 -lws2_32 -latk-1.0 -lws2_32 -lexpat -lwebp -lzstd -llzma -ljpeg -luuid -lz -lwinspool -lcomctl32 -lcomdlg32 -lpangoft2-1.0 -ltiff -lwebp -lzstd -llzma -lgdk_pixbuf-2.0 -ljpeg -lpangowin32-1.0 -lgmodule-2.0 -ldl -lffi -lpango-1.0 -lfribidi -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lexpat -lcairo -lz -lmsimg32 -lgdi32 -lpixman-1 -lz -lz -lmsimg32 -lgdi32 -lpixman-1 -lgio-2.0 -ldl -ldnsapi -liphlpapi -lz -lole32 -lshlwapi -luuid -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lpixman-1 -lfontconfig -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lexpat -lharfbuzz -lfreetype -lbz2 -lpng16 -lz -lharfbuzz_too -lfreetype_too -lole32 -lshlwapi -lpcre -lgobject-2.0 -lglib-2.0 -luuid -lintl -liconv -pthread -lws2_32 -lwinmm -lm -lole32 -lshlwapi -luuid

The source files compile to .o files OK, but then there are linking issues - see truncated output below and the full output (attached). I fear I may be on a fool's errand, but any advice on what do to next would be much appreciated... I am reasonably experienced in building packages on Linux, but not on Windows.

gcc -shared -s -static-libgcc -o RGtk2.dll tmp.def RGtkDataFrame.o Rgtk.o atkAccessors.o atkClasses.o atkConversion.o atkFuncs.o atkManuals.o atkUserFuncs.o cairo-enums.o cairoAccessors.o cairoConversion.o cairoFuncs.o cairoManuals.o cairoUserFuncs.o classes.o connections.o conversion.o eventLoop.o gdkAccessors.o gdkClasses.o gdkConversion.o gdkFuncs.o gdkManuals.o gdkUserFuncs.o gioAccessors.o gioClasses.o gioConversion.o gioFuncs.o gioManuals.o gioUserFuncs.o glib.o gobject.o gtkAccessors.o gtkClasses.o gtkConversion.o gtkFuncs.o gtkManuals.o gtkUserFuncs.o pangoAccessors.o pangoClasses.o pangoConversion.o pangoFuncs.o pangoManuals.o pangoUserFuncs.o utils.o zcompat.o -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lgdk-win32-2.0 -lgtk-win32-2.0 -limm32 -lshell32 -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/../lib -lws2_32 -lws2_32 -lpangocairo-1.0 -lws2_32 -lws2_32 -lws2_32 -lws2_32 -lws2_32 -latk-1.0 -lws2_32 -lexpat -lwebp -lzstd -llzma -ljpeg -luuid -lz -lwinspool -lcomctl32 -lcomdlg32 -lpangoft2-1.0 -ltiff -lwebp -lzstd -llzma -lgdk_pixbuf-2.0 -ljpeg -lpangowin32-1.0 -lgmodule-2.0 -ldl -lffi -lpango-1.0 -lfribidi -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lexpat -lcairo -lz -lmsimg32 -lgdi32 -lpixman-1 -lz -lz -lmsimg32 -lgdi32 -lpixman-1 -lgio-2.0 -ldl -ldnsapi -liphlpapi -lz -lole32 -lshlwapi -luuid -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lpixman-1 -lfontconfig -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lexpat -lharfbuzz -lfreetype -lbz2 -lpng16 -lz -lharfbuzz_too -lfreetype_too -lole32 -lshlwapi -lpcre -lgobject-2.0 -lglib-2.0 -luuid -lintl -liconv -pthread -lws2_32 -lwinmm -lm -lole32 -lshlwapi -luuid -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~1/R/R-42~1.2/bin/x64 -lR
C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/rtools42/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/libatk-1.0.a(atktext.c.obj):atktext.c:(.text+0x2e60): multiple definition of `atk_text_free_ranges'; atkManuals.o:atkManuals.c:(.text+0x120): first defined here


C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/rtools42/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/libgobject-2.0.a(gsourceclosure.c.obj):gsourceclosure:(.text+0x500): multiple definition of `g_io_condition_get_type'; gobject.o:gobject.c:(.text+0x5580): first defined here


C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/rtools42/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/libgtk-win32-2.0.a(gtkmain.o): in function `gtk_set_locale':


/root/mxe/tmp-gtk2-x86_64-w64-mingw32.static.posix/gtk+-2.24.29.build_/gtk/../../gtk+-2.24.29/gtk/gtkmain.c:1155: undefined reference to `gdk_set_locale'


C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/rtools42/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/libgtk-win32-2.0.a(gtktext.o): in function `gtk_text_get_chars':


/root/mxe/tmp-gtk2-x86_64-w64-mingw32.static.posix/gtk+-2.24.29.build_/gtk/../../gtk+-2.24.29/gtk/gtktext.c:1153: undefined reference to `gdk_wcstombs'


C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/rtools42/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/libgtk-win32-2.0.a(gtktext.o): in function `gtk_text_insert':


/root/mxe/tmp-gtk2-x86_64-w64-mingw32.static.posix/gtk+-2.24.29.build_/gtk/../../gtk+-2.24.29/gtk/gtktext.c:965: undefined reference to `gdk_mbstowcs'
...

linking-error.txt

@lawremi
Copy link
Owner

lawremi commented Feb 2, 2023

I made a couple of fixes, but most of these relate to how the Windows binaries are built. It looks like you'll need libtiff and pcre. I'm not sure why some of the win32-specific symbols in GDK are missing (like gdk_mbstowcs()). There may be an extra lib that needs to be on the linker line.

@davidcsterratt
Copy link
Author

Thanks - I will take a look when I'm back in my Windows partition. It looks like linking order is a really tricky problem in mingw32, but there are potential workarounds: https://cran.r-project.org/bin/windows/base/howto-R-4.2.html

@davidcsterratt
Copy link
Author

By using the findLinkingOrder in described in https://cran.r-project.org/bin/windows/base/howto-R-4.2.html to get the library order (along with a tweak) I've managed to compile an RGtk.so object using the following config in Makevars.win:

PKG_CPPFLAGS = -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/gtk-2.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/gtk-2.0/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/libpng16 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/atk-1.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/pango-1.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/cairo -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/gdk-pixbuf-2.0 -DPCRE_STATIC -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/harfbuzz -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/fribidi -DFRIBIDI_LIB_STATIC -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/freetype2 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/glib-2.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/glib-2.0/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/pixman-1 -pthread -mms-bitfields -D_R_=1 -DUSE_R=1 -I. -I../inst/include

PKG_LIBS = -lgtk-win32-2.0 -lwinspool -lspoolss -lgdk-win32-2.0 -lcomdlg32 -lcomctl32 -latk-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lpangoft2-1.0 -lcairo -lpango-1.0 -lpixman-1 -lmsimg32 -lgio-2.0 -lnetio -liphlpapi -lgobject-2.0 -lgmodule-2.0 -ldnsapi -lass -lffi -lfribidi -lfontconfig -lharfbuzz_too -lfreetype_too -lharfbuzz -lglib-2.0 -lfreetype -luuid -lpcre -lpng -lpng16 -lole32 -limm32 -lgdi32 -lintl -lbz2 -lshlwapi -ltiff -llzma -lzstd -lwebpdecoder -lwebp -ljpeg -liconv -lexpat -lz -lwsock32 -lws2_32

Unfortunately, The resulting DLL can't be loaded. In R we get

Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Users/David Sterratt/AppData/Local/R/win-library/4.2/RGtk2/libs/x64/RGtk2.dll':
LoadLibrary failure:  The specified module could not be found.

To debug this error, I've run WinDbg as described in it the Rtools HOWTO. I get these errors (among lots of other output):

4694:416c @ 19315093 - LdrpProcessWork - ERROR: Unable to load DLL: "NETIO.SYS", Parent Module: "C:\Users\David Sterratt\AppData\Local\R\win-library\4.2\RGtk2\libs\x64\RGtk2.dll", Status: 0xc0000135
4694:1f14 @ 19315125 - LdrpProcessWork - ERROR: Unable to load DLL: "WINSPOOL.DRV", Parent Module: "C:\Users\David Sterratt\AppData\Local\R\win-library\4.2\RGtk2\libs\x64\RGtk2.dll", Status: 0xc0000135
4694:0d0c @ 19315125 - LdrpProcessWork - ERROR: Unable to load DLL: "C:\Users\David Sterratt\AppData\Local\R\win-library\4.2\RGtk2\libs\x64\RGtk2.dll", Parent Module: "(null)", Status: 0xc0000135

winspool.drv seems to be in c:\Windows\System32, but I can't find netio.sys. I'll have to think about this another day...

@davidcsterratt
Copy link
Author

Checking using winbuild-devel (output attached) shows that the linking problem is not resolved with RTools4.3 - so the next step is to try that out.
windbuild-install.out-2023-02-06.txt

@davidcsterratt
Copy link
Author

Here is the results of trying with RTools4.3 and the appended contents of Makevars.win.

The package can be installed, but the resulting DLL can't be loaded.

> library(RGtk2)
Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared object 'C:/Users/David Sterratt/AppData/Local/R/win-library/4.3/RGtk2/libs/x
64/RGtk2.dll':
  LoadLibrary failure:  The specified module could not be found.

There are the same errors observed when running library(RGtk2) in R and using WinDbg:

0c64:0640 @ 44312812 - LdrpProcessWork - ERROR: Unable to load DLL: "NETIO.SYS", Parent Module: "C:\Users\David Sterratt\AppData\Local\R\win-library\4.3\RGtk2\libs\x64\RGtk2.dll", Status: 0xc0000135
...
0c64:1e5c @ 44312812 - LdrpProcessWork - ERROR: Unable to load DLL: "WINSPOOL.DRV", Parent Module: "C:\Users\David Sterratt\AppData\Local\R\win-library\4.3\RGtk2\libs\x64\RGtk2.dll", Status: 0xc0000135
...
0c64:00e4 @ 44312828 - LdrpProcessWork - ERROR: Unable to load DLL: "C:\Users\David Sterratt\AppData\Local\R\win-library\4.3\RGtk2\libs\x64\RGtk2.dll", Parent Module: "(null)", Status: 0xc0000135

Full output attached.
windbuild-install-rtools43.out-2023-02-11.txt

Contents of Makevars.win:

# Use the linking_order script to determine library order
# Install the latest version of R-devel from https://cran.r-project.org/
# Install Rtools43 from https://cran.r-project.org/
# Open the Rtools43 Bash shell
## Set Paths to R and various tools
# export PATH="/c/Program Files/R/R-devel/bin":$PATH
# export PATH=/x86_64-w64-mingw32.static.posix/bin/:$PATH
## Install pkg-config and add path
# pacman -Syy pkg-config
# PKG_CONFIG_PATH=/x86_64-w64-mingw32.static.posix/lib/pkgconfig/:$PKG_CONFIG_PATH

# Install a package in R using install.pacakges(), which will set the personal library path
# https://cran.r-project.org/bin/windows/base/howto-R-4.2.html
#  ./linking_order/findLinkingOrder RGtk2/RGtk2/ /tmp/RGtk2.libs /c/rtools42/x86_64-w64-mingw32.static.posix/lib

# pkg-config.exe --static --cflags  gtk+-2.0
# Add these flags: -D_R_=1 -DUSE_R=1 -I. -I../inst/include
PKG_CPPFLAGS = -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/pango-1.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/gtk-2.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/gtk-2.0/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/atk-1.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/cairo -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/gdk-pixbuf-2.0 -DPCRE2_STATIC -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/libpng16 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/harfbuzz -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/fribidi -DFRIBIDI_LIB_STATIC -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/freetype2 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/glib-2.0 -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/glib-2.0/include -I/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include/pixman-1 -pthread -mms-bitfields -D_R_=1 -DUSE_R=1 -I. -I../inst/include

# Use the linking_order script to determine library order by setting
# the PKG_LIBS below, then running (repeatedly)
# ./linking_order/findLinkingOrder RGtk2/RGtk2/ /tmp/RGtk2.libs
# PKG_LIBS = -Wl,--no-demangle $(shell cat /tmp/RGtk2.libs)

# This is the set of PKG_LIBS found by findLinkingOrder
# PKG_LIBS = -lgtk-win32-2.0 -lwinspool -lspoolss -lgdk-win32-2.0 -lcomdlg32 -lcomctl32 -latk-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lpangoft2-1.0 -lcairo -ldwrite -lpango-1.0 -lpixman-1 -lmsimg32 -lfontconfig -lgio-2.0 -lfribidi -lexpat -lnetio -liphlpapi -lgobject-2.0 -lgmodule-2.0 -ldnsapi -lffi -lharfbuzz_too -lfreetype_too -lharfbuzz -lglib-2.0 -lfreetype -luuid -lpcre2-8 -lpng16 -lpng -lbz2 -lole32 -limm32 -lgdi32 -ltiff -lwebpdecoder -lwebp -llzma -ljpeg -lcfitsio -lzstd -lz -lintl -liconv -lwsock32 -lws2_32 -lshlwapi

# There are duplicated symbols between -lcfitsio and -lz - remove -lcfitsio
PKG_LIBS = -lgtk-win32-2.0 -lwinspool -lspoolss -lgdk-win32-2.0 -lcomdlg32 -lcomctl32 -latk-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lpangoft2-1.0 -lcairo -ldwrite -lpango-1.0 -lpixman-1 -lmsimg32 -lfontconfig -lgio-2.0 -lfribidi -lexpat -lnetio -liphlpapi -lgobject-2.0 -lgmodule-2.0 -ldnsapi -lffi -lharfbuzz_too -lfreetype_too -lharfbuzz -lglib-2.0 -lfreetype -luuid -lpcre2-8 -lpng16 -lpng -lbz2 -lole32 -limm32 -lgdi32 -ltiff -lwebpdecoder -lwebp -llzma -ljpeg -lzstd -lz -lintl -liconv -lwsock32 -lws2_32 -lshlwapi

@davidcsterratt
Copy link
Author

Here is the output from devtools::check_win_devel(). There are some deprecated function calls (see issue #11), which might be causing problems?
winbuilder-devel-00check.log

@kevinushey
Copy link

What is the PATH environment variable set to in the place where you're running R?

My understanding is those drivers are normally located in the "standard" system locations, e.g. C:\Windows\System32, so the only thing I can imagine is that for some reason they're not on the PATH.

@davidcsterratt
Copy link
Author

davidcsterratt commented Feb 13, 2023

@kevinushey I will double-check, when back in my Windows partition.

However, there has also been some help from Ivan Krylov on the r-package-devel email list:

The failure to load WINSPOOL.DRV is perplexing (it should normally be possible to load as it's a system DLL that applications are supposed to link against in order to be able to print), but NETIO.SYS should probably be absent from the import list. At least it seems to be linked against some kernel-related stuff that shouldn't be reachable from userspace applications.

By removing -lnetio from PKG_LIBS, I was able to load the package and run some example code from the JSS article, but then Rgui.exe crashed on exit. I'm running R-4.2.2 and Rtools43 on a Windows 7 machine, which could also be a source of the difference.

Does the Dependency Walker https://dependencywalker.com/ provide you any useful information about the package DLL besides what you already know? (Some warnings deep in the dependency tree are to be expected. R.DLL is not on the PATH so won't be automatically found, but other dependencies should exist.)

I tried removing -lnetio, but the package didn't install at all on Windows 10.

I looked at the Dependency Walker, but it was giving me many messages
about missing DLLs with names like

  API-MS-WIN-CORE-STRING-L2-1-0.DLL  Error opening file. The system
cannot find the file specified (2).

These libraries seem to be part of the UCRT system. However, when I looked at the DLL of a package that did load in Dependency Walker, I got the same messages, so I think the path to the UCRT files may be missing.

Dependency Walker did seem to find:

  c:\windows\system32\WINSPOOL.DRV

For NETIO.SYS it gave the " Error opening file. The system cannot find
the file specified (2)." There was also this table in the output.

     [ ? ] NETIO.SYS

          Import  Ordinal  Hint          Function                Entry Point
          ------  -------  ------------  ----------------------  ------ -----
          [CE ]       N/A    4 (0x0004)  CancelMibChangeNotify2  Not Bound
          [CE ]       N/A   79 (0x004F)  GetIpForwardTable2      Not Bound
          [CE ]       N/A  364 (0x016C)  NotifyRouteChange2      Not Bound
          [CE ]       N/A  529 (0x0211)  if_nametoindex          Not Bound

@davidcsterratt
Copy link
Author

In a different post, Uwe Ligges suggested

Note that Gtk2 is end of life, Gtk4 was released 3 years ago already. There are reasons why neither the former RGtk2 maintainer nor the CRAN team decided to maintain RGtk2 further on.

I've queried:

Supposing that someone wanted to investigate updating RGtk2 to RGtk4 and upload the updated package to CRAN, what would be the possible approaches (if any) to include the RGtk4 libraries, so that the package could be compiled on the CRAN build servers? Either (1) include the Gtk4 source code (and any necessary dependencies) in the R
package; or (2) have RGtk4 dev libraries installed on build servers (I'm assuming that they are not currently installed).

Uwe's response:

If you need some details, perhaps simply ask Michael Lawrence. He certainly knows better than most readers what the issues are, or at least were when RGtk2 got archived.

Tomas Kalibera has responded to the same question:

For reference, there is an old patch for RGtk2 package that I had created when working on Rtools42, though I am not very optimistic it will help in this case:

https://svn.r-project.org/R-dev-web/trunk/WindowsBuilds/winutf8/ucrt3/r_packages/old_patches/CRAN/RGtk2.diff

I've added gtk2 libraries to Rtools42 as they were needed by a CRAN package (RGtk2) at that time and available in MXE. Now MXE has gtk3, but not gtk4.

If there is a need for gtk4 in a CRAN package, the best way forward would be to contribute gtk4 build configuration to MXE, ideally also after testing it builds as part of Rtools43 (which is a subset of MXE but with some updates not yet upstream). We could then replace gtk2 by gtk4 in Rtools. CRAN servers will then get gtk4 simply via updating Rtools.

This is only what would be needed for Windows. For macOS, gtk4 would have to be added to the recipes. For Linux, the package should work with gtk4 distributions available in main distributions.

If you wanted to use gtk from a package, perhaps it would be easier to try directly, not via the archived RGtk2 package.

It seems clear that if there is a need for the R Gtk bindings, a way has to be found of upgrading the package to work with at least Gtk3, and ultimately Gtk4. This would clearly be an investment of effort, so I'm going to check what the block with using the gWidgets2Tcl bindings was - the original reason for using RGtk2 (as well as it looking nicer).

@davidcsterratt
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants