The R package blavaan depends on rstan and compiles a Stan model at installation. The package passes the CRAN checks and also works locally. But the r-universe builds are failing with a “stan/version.hpp: No such file or directory” error. I first thought it might be related to the fact that the r-universe Stan packages are at different versions as compared to CRAN. But I believe that r-universe is using the CRAN versions of Stan packages in the blavaan build. Now I am unsure how to proceed.
The r-universe logs of the failed build can be seen here. I appreciate any ideas or hints!
I know @avehtari has recently been looking at r-universe, but @andrjohns might be the best person to answer this. Looking at the logs and the StanHeaders artifact, the version.hpp file is in include/src/stan/version.hpp, but the -I flags only feature the include folder, not also include/src.
Thanks for figuring this out! Is this true on CRAN too or just R-universe? It’s interesting that @edm reported that CRAN checks were passing but R-universe checks were failing.
Indeed this seems to be specific to R-universe. That said Writing R Extensions states that
The ‘NeedsCompilation’ field […] is normally set by R CMD build or the repository assuming compilation is required if and only if the package has a src directory.
which makes me think that indeed we shouldn’t set NeedsCompilation if we generate src only at build time through rstantools::rstan_config(). R-universe applies a “fix” if the metadata is inconsistent (NeedsCompilation: yes and no src/ directory) which broke our package installs.