On 12/11/24 05:23, Satyaprakash Nayak wrote:
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

Technically, it is possible to build sundials from the downloaded source code using cmake on Windows pretty much like on Unix. Rtools includes cmake as well as the toolchains and libraries to build sundials. The older version of sundialr was building sundials on Windows using make, there is no technical reason why it couldn't do that using cmake (and downloaded _sources_) as well.

I was able to build the new sundialr on my Windows with these changes, and the package passed its checks (with some warnings):

1. delete Makevars.win and Makevars.ucrt
2. create configure.win file with this content in the package root directory

---

#! /bin/sh

./configure $*

---

Whenever in doubt, I would recommend starting with the same code for Unix and Windows. Only customize for Windows (or macOS or another system) if needed.

Best Tomas

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

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to