[R-pkg-devel] Unable to load Windows NETIO.SYS and WINSPOOL.DRV DLLs

2023-02-11 Thread David Sterratt
[I've posted this to r-devel, and just realised that I should have
posted it to this list instead - apologies to those on both lists for
the extra email.]

I am trying to build the RGtk2 package
(https://github.com/lawremi/RGtk2) using R-devel and only the libraries
bundled with RTookl4.3 (currently RGtk2 is bundled with a compiled dll
and requires GTK libraries to be downloaded after installation into R).

I have used the instructions at
https://cran.r-project.org/bin/windows/base/howto-R-4.2.html
to create a Makevars.win file (appended, including description of how
the PKG_LIBS have been set).

The package can be installed, but the shared object created 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.

WinDbg output reveals errors loading "NETIO.SYS" and "WINSPOOL.DRV"
when running "library(RGtk2)":

   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: 0xc135
   ...
   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:
0xc135

I'm stuck at this point: I'm not a regular Windows User, and I've not
been able to find any trustworthy advice online about how to deal with
missing DLLs. Any help would be appreciated.

There is an issue on Github about this issue with full output from
WinDbg:
https://github.com/lawremi/RGtk2/issues/9

Best wishes,

David

* * *

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

# 

Re: [R-pkg-devel] Unable to load Windows NETIO.SYS and WINSPOOL.DRV DLLs

2023-02-12 Thread David Sterratt
On Sun, 2023-02-12 at 15:04 +0100, Uwe Ligges wrote:
> 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.

Thank you. I know that Gtk2 is end-of-life, but I was thinking that the
inclusion of the Gtk2 library in RTools4.3 meant that it was still seen
as usable. I have an R package that is built around the gWidgets2RGtk2
interface  - it had some features that the Tcl/Tk interface didn't
have.

Anyway, *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).

Best wishes,

David

--
David Sterratt, Lecturer https://www.ed.ac.uk/profile/sterratt
Institute for Adaptive and Neural Computation tel: +44 131 651 1739
School of Informatics, University of Edinburgh
Appleton Tower, 11 Crichton Street, Edinburgh EH8 9LE, Scotland
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
BOOK: Principles of Computational Modelling in Neuroscience
Sterratt, Graham, Gillies & Willshaw (CUP, 2011).
http://www.compneuroprinciples.org



The University of Edinburgh is a charitable body, registered in Scotland, with 
registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh 
Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Unable to load Windows NETIO.SYS and WINSPOOL.DRV DLLs

2023-02-12 Thread David Sterratt
On Sat, 2023-02-11 at 18:11 +0300, Ivan Krylov wrote:
> On Sat, 11 Feb 2023 11:19:42 +
> David Sterratt  wrote:
>
> > WinDbg output reveals errors loading "NETIO.SYS" and "WINSPOOL.DRV"
> > when running "library(RGtk2)":
> >
> >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: 0xc135
> >...
> >    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: 0xc135
>
> 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.

Thank you for looking at this. I tried removing -lnetio, but package
didn't install at all on Windows 10.

> 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 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
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  FunctionEntry
Point
  --  ---    --  --
-
  [CE ]   N/A4 (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

If you're really interested, I can send you the output, but from what
Uwe says, I'm wondering if this is a lost cause!

Best wishes,

David.


--
David Sterratt, Lecturer https://www.ed.ac.uk/profile/sterratt
Institute for Adaptive and Neural Computation tel: +44 131 651 1739
School of Informatics, University of Edinburgh
Appleton Tower, 11 Crichton Street, Edinburgh EH8 9LE, Scotland
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
BOOK: Principles of Computational Modelling in Neuroscience
Sterratt, Graham, Gillies & Willshaw (CUP, 2011).
http://www.compneuroprinciples.org



The University of Edinburgh is a charitable body, registered in Scotland, with 
registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh 
Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Unable to load Windows NETIO.SYS and WINSPOOL.DRV DLLs

2023-02-14 Thread David Sterratt
On Mon, 2023-02-13 at 19:08 +0100, Tomas Kalibera wrote:
> 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

Many thanks. I've not tried this patch yet, but it looks like it's not
made the development version of RGtk2, which is what I had been working
with. I will try out the archived RGtk2_2.20.36.3.tar.gz

> 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.

This is helpful to know, as it suggests that if RGtk2 could be updated
to work with Gtk4, installed into MXE, and if the Mac recipies could be
updated, the changes RTools might be accepted, and then RGtk2 (perhaps
renamed RGtk4) might be uploadable to CRAN.

From this message, and Uwe's it's clear that the long-term future of
RGtk2 depends on an update to Gtk4, and I've asked the maintainer about
what the prospects of that might be:
https://github.com/lawremi/RGtk2/issues/12

Best wishes,

David
The University of Edinburgh is a charitable body, registered in Scotland, with 
registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh 
Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Cannot submit package due to misspell note

2018-04-07 Thread David Sterratt
|On the subject of spell-checking, to avoid false positives when I'm 
checking the package, in the directory above the package directory I 
create a file called .spell_ignore with one word per line, and then run|:
|||devtools::spell_check("pkg/", dict="en_GB", 
ignore=read.table(".spell_ignore", stringsAsFactors=FALSE)$V1)
All the false positives still come through in the CRAN check, but it 
makes checking easier for me.


David.
|
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel