I am building a package with provides a wrapper around the cvode solver from the SUNDIALS ODE solving C library.
So far, I have been able to compile the package on my OS X machine by providing the source C files (taking inspiration from the Makevars from RcppCAF package) and making the static library on the fly and linking against it. The Makevars file can be found at the link below
https://github.com/sn248/Rcppsbmod/blob/master/src/Makevars
Earlier I was linking against static libraries on the system but now since I am making the static library (libsundials_all.a) on the fly when compiling the package, I believe users who don't have SUNDIALS installed on their system (at least on OS X) should be able to use this package also (Am I correct in thinking this?). I have checked the package compiled in such a way is able to integrate the a test ODE. Also, When I run a R CMD check (using Check option on RStudio, with --as-cran option), I get success, i.e.,
R CMD check results
0 errors | 0 warnings | 0 notes
However, I want users on Windows to be able to use this package, even if they don't have SUNDIALS installed on their machine, my questions are
- Is this possible to do or Windows users need to have SUNDIALS installed?
Currently my
Makevars.winis same asMakevars, so when I submit my package on R WinBuilder, I get the following message (which tells me thatmakeis not able to findar).make: ar: Command not foundmake: *** [../inst/libsundials_all.a] Error 127Warning: running command 'make -f "Makevars.win" -f "D:/RCompile/recent/R-3.4.3/etc/i386/Makeconf" -f "D:/RCompile/recent/R-3.4.3/etc/i386/Makevars.site" -f "D:/RCompile/recent/R-3.4.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="Rcppsbmod.dll" ' had status 2ERROR: compilation failed for package 'Rcppsbmod'* removing 'd:/RCompile/CRANguest/R-release/lib/Rcppsbmod'In R CMD INSTALL
Some searching revealed that RTools might not have ar,here but I don't think I am clear about what I should be doing to compile this package on Windows. I have looked a few Makevars.win files, but most of them are similar to Makevars. I feel I need to make a .dll (similar to libsundials_all.a, but I am not sure how to go about it at all.
Any suggestion here about how I can compile this package on Windows will be much appreciated!
Also, just for my curiosity, I often find code such (e.g., in Makevars.in of rcppgsl)
GSL_LIBS = @GSL_LIBS@
I am not sure what @GSL_LIBS@ means and make tutorials didn't have this syntax either. Any explanation of this code will be very helpful.
Thanks!
GSL_LIBSis the windows convention. Using@GSL_LIBSdesignatesautoconf, ie the value will get filled in (on Linux, Unix, macOS, ...) by theconfigurescript. I explained that in a few places too; you can just follow package RcppGSL or, easier, other packages using RcppGSL -- eg my small RcppZiggurat. - Dirk Eddelbuettel