[R-pkg-devel] Creating and hosting static libraries for package installation on Windows

Satyaprakash Nayak @n248 @end|ng |rom corne||@edu
Wed Dec 11 05:23:41 CET 2024


Hi r-package-devel

I am working on updating my package `sundialr` (
https://cran.r-project.org/web/packages/sundialr/index.html), wherein I was
earlier bundling the C source files with the package, but now I am using
`cmake` to create static libraries for the upstream C library SUNDIALS
which the package provides an interface for. In brief, the previous
approach can be found at:

https://github.com/sn248/sundialr/blob/master/src/Makevars

And the new approach can be seen below (heavily borrowed from nloptr
package installation approach):

https://github.com/sn248/sundialr/blob/cmake-install/tools/cmake_call.sh

The second approach works successfully on linux and macOS platforms
(checked by rhub).

I am struggling to get this working on a Windows platform, and have looked
at a few packages (e.g., nloptr, rcppredis, openssl) which have solved this
issue. As I understand the following steps are required to get the static
libraries in correct locations for package installation on the Windows

1) Host the .tar.gz files or .zip files on https://github.com/rwinlib/
(deprecated now) or https://github.com/r-windows/bundles/releases/download/
which should contain the static libraries (*.a files) in separate folders
for i386, x64-ucrt and x-64 platforms and required header files in the
`include` folder.

2) Use a winlibs.R file within the `tools` sub-directory in the package
file structure to download the .zip or .tar.gz file and extract them to a
`windows` directory.

3) Set PKG_CPPFLAGS and PKG_LIBS via Makewars.win file in src sub-directory
in the package files.

Currently, I am struggling with Step #1, i.e., how to create the required
.zip or .tar.gz files and host them on
https://github.com/r-windows/bundles/releases for download. I will be
thankful if any one can provide some guidance in this regard.

Sincerely
Satya

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list