Closed wlandau closed 10 months ago
@jgabry, are there environment variables I can set up front in a platform-independent way to ensure Stan models compile inside install.packages()
the same way they would ordinarily compile outside package installation?
To be honest, I'm not sure I fully understand why there's currently a difference inside vs outside install.packages
. @rok-cesnovar @andrjohns any thoughts on CmdStan environment variables that could help here?
Try using withr::with_makevars()
to control the makeflags being used (example here)
with_makevars()
could definitely help with stan_package_compile()
and internal CmdStan installation if I know what environment variables to set and the values to supply. Is there a safe/universal configuration I can use? I see the with_makevars()
call you shared sets USE_CXX14 = 1
, PKG_CPPFLAGS = ""
for sufficiently recent CmdStan, and some custom stuff for PKG_CXXFLAGS
and PKG_LIBS
. Are those the only envvars I would need? Would it be reasonable to emulate rcpp_source_stan()
and get_cmdstan_flags()
?
Every compilation in
instantiate
happens insideinstall.packages()
, which messes with compiler settings likeCXXFLAGS
. https://github.com/stan-dev/cmdstanr/issues/787 is just one instance of this. It would be great to reliably configure the toolchain.