From D@v|d@C@Sterr@tt @end|ng |rom ed@@c@uk  Sat Feb 11 12:12:04 2023
From: D@v|d@C@Sterr@tt @end|ng |rom ed@@c@uk (David Sterratt)
Date: Sat, 11 Feb 2023 11:12:04 +0000
Subject: [Rd] Unable to load Windows NETIO.SYS and WINSPOOL.DRV DLLs
Message-ID: <64d8c5ea00cccbbd6bb7f92a506e97d2e9f5168a.camel@ed.ac.uk>

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

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

# 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


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


[Rd] Unable to load Windows NETIO.SYS and WINSPOOL.DRV DLLs
David Sterratt