How to update a package that has StanHeaders and rstan in its LinkingTo, part II


#1

If you have a R package on CRAN that has StanHeaders in its LinkingTo, you likely received an email from CRAN objecting to some of the patterns rstanarm has used since 2015 to build. Please do not forward or quote from that email because reasons. If you have a R package that is going to CRAN eventually but was created since 2015, you will likely need to change some of them.

I will update this thread after trying some alternative build syntax and seeking clarification from CRAN.


Developing a package that uses rstan - Pre-translated c++ files
How to update a package that has StanHeaders and rstan in its LinkingTo
#2

It seems as if setting the first line of src/Makevars and src/Makevars.win as

STANHEADERS_SRC = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "message()" -e "cat(system.file('include', 'src', package = 'StanHeaders', mustWork = TRUE))" -e "message()" | grep "StanHeaders")

the second line as

PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error

and the third line as

CXX_STD = CXX14

will work on all CRAN servers. Whether it is also acceptable to CRAN remains to be seen.


#3

Is there some news on acceptance by CRAN of this approach?

Thanks much for following this up.


#4

There is not. Another package maintainer emailed me to say that my proposal did not work without extra \ on a Mac. Using

STANHEADERS_SRC = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "message()" -e "cat(system.file('include', 'src', package = 'StanHeaders', mustWork = TRUE))" -e "message()" | grep "StanHeaders")

also works for me and likely wherever sep = '\n' would not.


#5

Both packages now have been accepted by CRAN. Thanks @bgoodri, Uwe Ligges and all other contributors.