rstantools icon indicating copy to clipboard operation
rstantools copied to clipboard

rstantools cannot find `stan/version.hpp`

Open wlandau opened this issue 3 years ago • 7 comments

I am developing a package with a stan model and using rstantools for configuration. On my MacBook, R cannot find stan/version.hpp when it tries to compile the package. I think the file may belong in /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include, but it is not on my system after installing StanHeaders 2.21.0-7 (either source or binary) and upgrading to rstan 2.21.5 and rstantools 2.2.0.

list.files("/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan")
#> [1] "math"     "math.hpp"

Models like the one below still compile successfully with rstan.

model_code <- "
data {
  real y;
}
parameters {
  real theta;
}
model {
  y ~ normal(theta, 1);
  theta ~ normal(0, 1);
}
"
model <- rstan::stan_model(model_code = model_code)
model
#>
#> > model
#> S4 class stanmodel 'f851b51190fe252f738e2d3974c697af' coded as follows:
#> 
#> data {
#>   real y;
#> }
#> parameters {
#>   real theta;
#> }
#> model {
#>   y ~ normal(theta, 1);
#>   theta ~ normal(0, 1);
#> }

I followed the usual steps to build this model into an R package.

setwd(fs::dir_create(tempfile()))
usethis::create_package("testpackage", open = FALSE)
setwd("testpackage")
roxygen <- c(
  "#' @import Rcpp methods",
  "#' @importFrom rstan sampling",
  "#' @useDynLib testpackage, .registration = TRUE",
  "NULL"
)
fs::dir_create("R")
writeLines(roxygen, "R/roxygen.R")
devtools::document()
fs::dir_create(file.path("inst", "stan"))
writeLines(model_code, file.path("inst", "stan", "model.stan"))
rstantools::use_rstan()
install.packages(".", type = "source", repos = NULL)

I ran into this error during compilation when I try to install the package.

In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:4:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/stan_fit.hpp:11:10: fatal error: 
      'stan/version.hpp' file not found
#include <stan/version.hpp>
         ^~~~~~~~~~~~~~~~~~
14 warnings and 1 error generated.
make: *** [stanExports_model.o] Error 1
ERROR: compilation failed for package ‘testpackage’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/testpackage’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/testpackage’
Warning message:
In install.packages(".", type = "source", repos = NULL) :
  installation of package ‘.’ had non-zero exit status

This issue looks similar to #47, but it has been long enough since https://discourse.mc-stan.org/t/how-to-update-a-package-that-has-stanheaders-and-rstan-in-its-linkingto/6041?u=bgoodri and https://discourse.mc-stan.org/t/how-to-update-a-package-that-has-stanheaders-and-rstan-in-its-linkingto-part-ii/6214/4?u=bgoodri that the package Makevars written by rstantools. And I do not have a "~/.R/Makevars".

> writeLines(readLines("src/Makevars"))
# Generated by rstantools.  Do not edit by hand.

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")

STANC_FLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "cat(ifelse(utils::packageVersion('rstan') >= 2.26, '-DUSE_STANC3',''))")
PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error $(STANC_FLAGS)
PKG_CXXFLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::CxxFlags()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::CxxFlags()")
PKG_LIBS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::RcppParallelLibs()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::LdFlags()")

CXX_STD = CXX14
Complete compilation log
* installing *source* package ‘testpackage’ ...
** using staged installation
** libs


clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeader/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error  -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include' -I/usr/local/include   -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -D_REENTRANT -DSTAN_THREADS   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Core:540:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:2:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/LU:47:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Cholesky:12:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Jacobi:29:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Cholesky:43:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/QR:15:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Householder:27:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/QR:48:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:5:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SVD:48:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:6:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Geometry:58:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:7:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:26:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseCore:66:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:27:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:29:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:32:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseQR:34:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:33:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:32:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/CholmodSupport:45:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:35:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/KroneckerProduct:34:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:39:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/Polynomials:135:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:40:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
18 warnings generated.


clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeader/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error  -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include' -I/usr/local/include   -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -D_REENTRANT -DSTAN_THREADS   -fPIC  -Wall -g -O2  -c stanExports_model.cc -o stanExports_model.o
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Core:540:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:2:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/LU:47:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Cholesky:12:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Jacobi:29:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Cholesky:43:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/QR:15:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Householder:27:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:4:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/QR:48:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:5:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SVD:48:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:6:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Geometry:58:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:7:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:26:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseCore:66:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:27:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:29:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:32:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseQR:34:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:33:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: 
      pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from stanExports_model.cc:5:
In file included from ./stanExports_model.h:20:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:4:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/stan_fit.hpp:11:10: fatal error: 
      'stan/version.hpp' file not found
#include <stan/version.hpp>
         ^~~~~~~~~~~~~~~~~~
14 warnings and 1 error generated.
make: *** [stanExports_model.o] Error 1
ERROR: compilation failed for package ‘testpackage’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/testpackage’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/testpackage’
Warning message:
In install.packages(".", type = "source", repos = NULL) :
  installation of package ‘.’ had non-zero exit status
Session info
  • Mac OS 12.3.1
  • 2018 15-inch MacBook Pro
  • Using the Mac Terminal (not RStudio, VSCode, or other IDE).
$ gcc --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur/Monterey 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] testpackage_0.0.0.9000

loaded via a namespace (and not attached):
 [1] pillar_1.7.0      compiler_4.2.0    prettyunits_1.1.1 remotes_2.4.2    
 [5] tools_4.2.0       digest_0.6.29     testthat_3.1.4    pkgbuild_1.3.1   
 [9] pkgload_1.2.4     memoise_2.0.1     lifecycle_1.0.1   tibble_3.1.7     
[13] pkgconfig_2.0.3   rlang_1.0.2       cli_3.3.0         rstudioapi_0.13  
[17] xfun_0.31         fastmap_1.1.0     withr_2.5.0       stringr_1.4.0    
[21] roxygen2_7.1.2    xml2_1.3.3        knitr_1.39        desc_1.4.1       
[25] fs_1.5.2          vctrs_0.4.1       devtools_2.4.3    rprojroot_2.0.3  
[29] glue_1.6.2        R6_2.5.1          processx_3.5.3    fansi_1.0.3      
[33] sessioninfo_1.2.2 purrr_0.3.4       callr_3.7.0       magrittr_2.0.3   
[37] rstantools_2.2.0  ps_1.7.0          ellipsis_0.3.2    usethis_2.1.5    
[41] utf8_1.2.2        stringi_1.7.6     cachem_1.0.6      crayon_1.5.1     
[45] brio_1.1.3

wlandau avatar May 19 '22 21:05 wlandau

Odd, ~~compilation seems to complete successfully in the RStudio IDE (2022.07.1 Build 554)~~ but not in the Mac Terminal (same error).

> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.5

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] testpackage_0.0.0.9000

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9           prettyunits_1.1.1    ps_1.7.1             assertthat_0.2.1     rprojroot_2.0.3     
 [6] digest_0.6.29        utf8_1.2.2           R6_2.5.1             stats4_4.2.0         ggplot2_3.3.6       
[11] pillar_1.8.0         rlang_1.0.4          rstudioapi_0.13      whisker_0.4          callr_3.7.1         
[16] desc_1.4.1           devtools_2.4.3       stringr_1.4.0        loo_2.5.1            munsell_0.5.0       
[21] compiler_4.2.0       xfun_0.31            rstan_2.21.5         pkgconfig_2.0.3      pkgbuild_1.3.1      
[26] rstantools_2.2.0     tidyselect_1.1.2     tibble_3.1.8         gridExtra_2.3        roxygen2_7.2.1      
[31] codetools_0.2-18     matrixStats_0.62.0   fansi_1.0.3          crayon_1.5.1         dplyr_1.0.9         
[36] withr_2.5.0          brio_1.1.3           grid_4.2.0           gtable_0.3.0         lifecycle_1.0.1.9000
[41] DBI_1.1.3            magrittr_2.0.3       StanHeaders_2.21.0-7 scales_1.2.0         RcppParallel_5.1.5  
[46] cli_3.3.0            stringi_1.7.8        cachem_1.0.6         fs_1.5.2             remotes_2.4.2       
[51] testthat_3.1.4       xml2_1.3.3           ellipsis_0.3.2       generics_0.1.2       vctrs_0.4.1         
[56] tools_4.2.0          glue_1.6.2           purrr_0.3.4          processx_3.7.0       pkgload_1.3.0       
[61] parallel_4.2.0       fastmap_1.1.0        inline_0.3.19        colorspace_2.0-3     sessioninfo_1.2.2   
[66] memoise_2.0.1        knitr_1.39           usethis_2.1.6.9000  

wlandau avatar Aug 15 '22 14:08 wlandau

Not sure what changed, but the "fatal error: 'stan/version.hpp' file not found" is back in the same version of the RStudio IDE (2022.07.1 Build 554).

wlandau avatar Aug 22 '22 18:08 wlandau

Compilation succeeds if I manually replace the default package Makevars with the hard-coded Mac-specific one @andrjohns suggested at https://discourse.mc-stan.org/t/compilation-error-with-rstantools-on-mac-os-stan-version-hpp-file-not-found/28624/17 (copied below). Does this provide any clues as to what I can change on my system to make the default package Makevars work?

PKG_LIBS =  '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/lib//libStanServices.a' -L'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/lib/' -lStanHeaders -L'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/lib/' -ltbb
PKG_CPPFLAGS =   -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/"  -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/"  -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported"  -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/BH/include" -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/src/"  -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/"  -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include/"  -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include"  -I"../inst/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1

wlandau avatar Sep 21 '22 11:09 wlandau

Yes, the problem is the crossed versions. If you are developing a package to go to CRAN, then you should use the CRAN version of StanHeaders, rstan, and anything other dependencies.

On Thu, May 19, 2022 at 5:18 PM Will Landau @.***> wrote:

I am developing a package with a stan model and using rstantools for configuration. On my MacBook, R cannot find stan/version.hpp when it tries to compile the package. I think the file may belong in /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include, but it is not on my system after installing StanHeaders 2.21.0-7 (either source or binary) and upgrading to rstan 2.21.5 and rstantools 2.2.0.

list.files("/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan")

Models like the one below still compile successfully with rstan.

model_code <- " data { real y; } parameters { real theta; } model { y ~ normal(theta, 1); theta ~ normal(0, 1); } " model <- rstan::stan_model(model_code = model_code) model #> #> > model #> S4 class stanmodel 'f851b51190fe252f738e2d3974c697af' coded as follows: #> #> data { #> real y; #> } #> parameters { #> real theta; #> } #> model { #> y ~ normal(theta, 1); #> theta ~ normal(0, 1); #> }

I followed the usual steps to build this model into an R package.

setwd(fs::dir_create(tempfile())) usethis::create_package("testpackage", open = FALSE)

setwd("testpackage") roxygen <- c(

"#' @import Rcpp methods",

"#' @importFrom rstan sampling",

"#' @useDynLib testpackage, .registration = TRUE",

"NULL"

) fs::dir_create("R")

writeLines(roxygen, "R/roxygen.R") devtools::document() fs::dir_create(file.path("inst", "stan"))

writeLines(model_code, file.path("inst", "stan", "model.stan")) rstantools::use_rstan()

install.packages(".", type = "source", repos = NULL)

I ran into this error during compilation when I try to install the package.

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:4: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/stan_fit.hpp:11:10: fatal error:

  'stan/version.hpp' file not found

#include <stan/version.hpp>

     ^~~~~~~~~~~~~~~~~~

14 warnings and 1 error generated. make: *** [stanExports_model.o] Error 1 ERROR: compilation failed for package ‘testpackage’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/testpackage’

  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/testpackage’ Warning message: In install.packages(".", type = "source", repos = NULL) :

    installation of package ‘.’ had non-zero exit status

This issue looks similar to #47 https://github.com/stan-dev/rstantools/issues/47, but it has been long enough since https://discourse.mc-stan.org/t/how-to-update-a-package-that-has-stanheaders-and-rstan-in-its-linkingto/6041?u=bgoodri and https://discourse.mc-stan.org/t/how-to-update-a-package-that-has-stanheaders-and-rstan-in-its-linkingto-part-ii/6214/4?u=bgoodri that the package Makevars written by rstantools. And I do not have a "~/.R/Makevars".

writeLines(readLines("src/Makevars"))

Generated by rstantools. Do not edit by hand.

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")

STANC_FLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "cat(ifelse(utils::packageVersion('rstan') >= 2.26, '-DUSE_STANC3',''))") PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error $(STANC_FLAGS) PKG_CXXFLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::CxxFlags()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::CxxFlags()") PKG_LIBS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::RcppParallelLibs()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::LdFlags()")

CXX_STD = CXX14

Complete compilation log

  • installing source package ‘testpackage’ ... ** using staged installation ** libs

clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeader/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include' -I/usr/local/include -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -D_REENTRANT -DSTAN_THREADS -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:1: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Core:540: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:2: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/LU:47: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Cholesky:12: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Jacobi:29: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Cholesky:43: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/QR:15: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Householder:27: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/QR:48: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:5: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SVD:48: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:6: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Geometry:58: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:7: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:26: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseCore:66: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:27: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:29: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:32: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseQR:34: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:31: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:33: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:32: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/CholmodSupport:45: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:35: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/KroneckerProduct:34: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:39: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/Polynomials:135: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from RcppExports.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/RcppEigenForward.h:40: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

18 warnings generated.

clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeader/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include' -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include' -I/usr/local/include -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -D_REENTRANT -DSTAN_THREADS -fPIC -Wall -g -O2 -c stanExports_model.cc -o stanExports_model.o In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:1: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Core:540: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:2: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/LU:47: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Cholesky:12: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Jacobi:29: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Cholesky:43: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/QR:15: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Householder:27: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:4: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/QR:48: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:5: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SVD:48: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:6: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Geometry:58: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Dense:7: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:26: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseCore:66: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:27: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:29: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:32: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/SparseQR:34: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:3: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:14: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/Sparse:33: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning:

  pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

In file included from stanExports_model.cc:5: In file included from ./stanExports_model.h:20: In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/rstaninc.hpp:4: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include/rstan/stan_fit.hpp:11:10: fatal error:

  'stan/version.hpp' file not found

#include <stan/version.hpp>

     ^~~~~~~~~~~~~~~~~~

14 warnings and 1 error generated. make: *** [stanExports_model.o] Error 1 ERROR: compilation failed for package ‘testpackage’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/testpackage’

  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/testpackage’ Warning message: In install.packages(".", type = "source", repos = NULL) :

    installation of package ‘.’ had non-zero exit status

Session info

  • Mac OS 12.3.1
  • 2018 15-inch MacBook Pro
  • Using the Mac Terminal (not RStudio, VSCode, or other IDE).

$ gcc --version

Apple clang version 13.1.6 (clang-1316.0.21.2.5)

Target: x86_64-apple-darwin21.4.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

R version 4.2.0 (2022-04-22) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur/Monterey 10.16

Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:

[1] stats graphics grDevices utils datasets methods base

other attached packages:

[1] testpackage_0.0.0.9000

loaded via a namespace (and not attached):

[1] pillar_1.7.0 compiler_4.2.0 prettyunits_1.1.1 remotes_2.4.2

[5] tools_4.2.0 digest_0.6.29 testthat_3.1.4 pkgbuild_1.3.1

[9] pkgload_1.2.4 memoise_2.0.1 lifecycle_1.0.1 tibble_3.1.7

[13] pkgconfig_2.0.3 rlang_1.0.2 cli_3.3.0 rstudioapi_0.13

[17] xfun_0.31 fastmap_1.1.0 withr_2.5.0 stringr_1.4.0

[21] roxygen2_7.1.2 xml2_1.3.3 knitr_1.39 desc_1.4.1

[25] fs_1.5.2 vctrs_0.4.1 devtools_2.4.3 rprojroot_2.0.3

[29] glue_1.6.2 R6_2.5.1 processx_3.5.3 fansi_1.0.3

[33] sessioninfo_1.2.2 purrr_0.3.4 callr_3.7.0 magrittr_2.0.3

[37] rstantools_2.2.0 ps_1.7.0 ellipsis_0.3.2 usethis_2.1.5

[41] utf8_1.2.2 stringi_1.7.6 cachem_1.0.6 crayon_1.5.1

[45] brio_1.1.3

— Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstantools/issues/97, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ2XKUYFPTP6IYBERLNPITVK2V3RANCNFSM5WNPRTGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bgoodri avatar Oct 11 '22 07:10 bgoodri

I thought so at first, but I reinstalled the current CRAN versions of all the dependencies and I still get the "`stan/version.hpp;' file not found" error from the above reprex in both RStudio and the terminal.

  • Rcpp: 1.0.9
  • RcppEigen: 0.3.3.9.2
  • RcppParallel: 5.1.5
  • rstan: 2.21.7
  • rstantools: 2.2.0
  • StanHeaders: 2.21.0.7
> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

other attached packages:
[1] testpackage_0.0.0.9000

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9            prettyunits_1.1.1    
 [3] ps_1.7.1              assertthat_0.2.1     
 [5] rprojroot_2.0.3       digest_0.6.29        
 [7] utf8_1.2.2            mime_0.12            
 [9] R6_2.5.1              stats4_4.2.1         
[11] ggplot2_3.3.6         pillar_1.8.1         
[13] rlang_1.0.6           rstudioapi_0.14      
[15] miniUI_0.1.1.1        urlchecker_1.0.1     
[17] whisker_0.4           callr_3.7.2          
[19] desc_1.4.2            devtools_2.4.4       
[21] stringr_1.4.1         htmlwidgets_1.5.4    
[23] loo_2.5.1             munsell_0.5.0        
[25] shiny_1.7.2           compiler_4.2.1       
[27] httpuv_1.6.6          xfun_0.33            
[29] rstan_2.21.7          pkgconfig_2.0.3      
[31] pkgbuild_1.3.1        rstantools_2.2.0     
[33] htmltools_0.5.3       tidyselect_1.1.2.9000
[35] tibble_3.1.8          gridExtra_2.3        
[37] roxygen2_7.2.1        codetools_0.2-18     
[39] matrixStats_0.62.0    fansi_1.0.3          
[41] crayon_1.5.1          dplyr_1.0.10         
[43] withr_2.5.0           later_1.3.0          
[45] grid_4.2.1            xtable_1.8-4         
[47] gtable_0.3.1          lifecycle_1.0.2      
[49] DBI_1.1.3             magrittr_2.0.3       
[51] StanHeaders_2.21.0-7  scales_1.2.1         
[53] RcppParallel_5.1.5    cli_3.4.1            
[55] stringi_1.7.8         cachem_1.0.6         
[57] remotes_2.4.2         fs_1.5.2             
[59] promises_1.2.0.1      xml2_1.3.3           
[61] ellipsis_0.3.2        generics_0.1.3       
[63] vctrs_0.4.1           tools_4.2.1          
[65] glue_1.6.2            purrr_0.3.4          
[67] pkgload_1.3.0         processx_3.7.0       
[69] parallel_4.2.1        fastmap_1.1.0        
[71] inline_0.3.19         colorspace_2.0-3     
[73] sessioninfo_1.2.2     memoise_2.0.1        
[75] knitr_1.40            profvis_0.3.7        
[77] usethis_2.1.6.9000   

wlandau avatar Oct 11 '22 15:10 wlandau

@andrjohns has helped me a lot in https://discourse.mc-stan.org/t/compilation-error-with-rstantools-on-mac-os-stan-version-hpp-file-not-found/28624/19 to arrive at a hard-coded package Makevars that just works on my Mac, but I am still unsure how to fix my system.

wlandau avatar Oct 11 '22 15:10 wlandau