I’m trying to install CmdStan but I can’t compile the Bernoulli example. The issue seems to be described in the following lines:
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/Map.h:142:31: note: initializing argument 1 of 'Eigen::Map<MatrixType, MapOptions, StrideType>::Map(Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType, Eigen::Index, const StrideType&) [with PlainObjectType = Eigen::Matrix<double, -1, 1>; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType = double*; Eigen::Index = long long int]'
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/Map.h:142:31: note: initializing argument 1 of 'Eigen::Map<MatrixType, MapOptions, StrideType>::Map(Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType, Eigen::Index, const StrideType&) [with PlainObjectType = Eigen::Matrix<int, -1, 1>; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType = int*; Eigen::Index = long long int]'
Not sure what’s going on! I’m out of ideas.
Here’s exactly the code I used to generate this error:
Microsoft Windows [Version 10.0.17763.4131]
(c) 2018 Microsoft Corporation. All rights reserved.
U:\>C:
C:\>cd Users\ter58_RS\cmdstan
C:\Users\ter58_RS\cmdstan>mingw32-make build
NOTE: Please add C:/Users/ter58_RS/cmdstan/stan/lib/stan_math/lib/tbb to your PATH variable.
You may call
mingw32-make install-tbb
to automatically update your user configuration.
--- CmdStan v2.31.0 built ---
C:\Users\ter58_RS\cmdstan>mingw32-make install-tbb
cmd.exe /C install-tbb.bat
Permanently setting the PATH user environment variable:
SUCCESS: Specified value was saved.
Please close this shell and open a new shell.
This will make the changes to the PATH variable
become active.
C:\Users\ter58_RS\cmdstan>mingw32-make examples/bernoulli/bernoulli.exe
--- Compiling, linking C++ code ---
g++ -Wno-nonnull -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs -Wno-int-in-bool-context -Wno-attributes -Wno-ignored-attributes -I stan/lib/stan_math/lib/tbb_2020.3/include -O3 -I src -I stan/src -I stan/lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.4.0 -I stan/lib/stan_math/lib/boost_1.78.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials -D_USE_MATH_DEFINES -DBOOST_DISABLE_ASSERTS -c -Wno-ignored-attributes -x c++ -o examples/bernoulli/bernoulli.o examples/bernoulli/bernoulli.hpp
In file included from stan/src/stan/model/model_header.hpp:8:
stan/src/stan/io/deserializer.hpp: In instantiation of 'stan::io::deserializer<T>::deserializer(RVec&, IntVec&) [with RVec = const std::vector<double, std::allocator<double> >; IntVec = const std::vector<int>; stan::require_all_vector_like_t<RVec, IntVec>* <anonymous> = 0; T = double]':
examples/bernoulli/bernoulli.hpp:163:46: required from 'void bernoulli_model_namespace::bernoulli_model::unconstrain_array_impl(const VecVar&, const VecI&, VecVar&, std::ostream*) const [with VecVar = std::vector<double, std::allocator<double> >; VecI = std::vector<int>; stan::require_vector_t<T_y>* <anonymous> = 0; stan::require_vector_like_vt<std::is_integral, VecI>* <anonymous> = 0; std::ostream = std::basic_ostream<char>]'
examples/bernoulli/bernoulli.hpp:306:36: required from here
stan/src/stan/io/deserializer.hpp:120:30: error: invalid conversion from 'const double*' to 'Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >::PointerArgType' {aka 'double*'} [-fpermissive]
i_size_(data_i.size()) {}
^
In file included from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:308,
from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Dense:1,
from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22,
from stan/lib/stan_math/stan/math/rev.hpp:4,
from stan/lib/stan_math/stan/math.hpp:19,
from stan/src/stan/model/model_header.hpp:4:
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/Map.h:142:31: note: initializing argument 1 of 'Eigen::Map<MatrixType, MapOptions, StrideType>::Map(Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType, Eigen::Index, const StrideType&) [with PlainObjectType = Eigen::Matrix<double, -1, 1>; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType = double*; Eigen::Index = long long int]'
inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType())
~~~~~~~~~~~~~~~^~~~~~~
In file included from stan/src/stan/model/model_header.hpp:8:
stan/src/stan/io/deserializer.hpp:120:30: error: invalid conversion from 'const int*' to 'Eigen::Map<Eigen::Matrix<int, -1, 1>, 0, Eigen::Stride<0, 0> >::PointerArgType' {aka 'int*'} [-fpermissive]
i_size_(data_i.size()) {}
^
In file included from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:308,
from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Dense:1,
from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22,
from stan/lib/stan_math/stan/math/rev.hpp:4,
from stan/lib/stan_math/stan/math.hpp:19,
from stan/src/stan/model/model_header.hpp:4:
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/Map.h:142:31: note: initializing argument 1 of 'Eigen::Map<MatrixType, MapOptions, StrideType>::Map(Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType, Eigen::Index, const StrideType&) [with PlainObjectType = Eigen::Matrix<int, -1, 1>; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType = int*; Eigen::Index = long long int]'
inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType())
~~~~~~~~~~~~~~~^~~~~~~
In file included from stan/src/stan/model/model_header.hpp:8:
stan/src/stan/io/deserializer.hpp: In instantiation of 'stan::io::deserializer<T>::deserializer(RVec&, IntVec&) [with RVec = const Eigen::Matrix<double, -1, 1>; IntVec = const std::vector<int>; stan::require_all_vector_like_t<RVec, IntVec>* <anonymous> = 0; T = double]':
examples/bernoulli/bernoulli.hpp:163:46: required from 'void bernoulli_model_namespace::bernoulli_model::unconstrain_array_impl(const VecVar&, const VecI&, VecVar&, std::ostream*) const [with VecVar = Eigen::Matrix<double, -1, 1>; VecI = std::vector<int>; stan::require_vector_t<T_y>* <anonymous> = 0; stan::require_vector_like_vt<std::is_integral, VecI>* <anonymous> = 0; std::ostream = std::basic_ostream<char>]'
examples/bernoulli/bernoulli.hpp:316:36: required from here
stan/src/stan/io/deserializer.hpp:120:30: error: invalid conversion from 'const Scalar*' {aka 'const double*'} to 'Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >::PointerArgType' {aka 'double*'} [-fpermissive]
i_size_(data_i.size()) {}
^
In file included from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:308,
from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Dense:1,
from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22,
from stan/lib/stan_math/stan/math/rev.hpp:4,
from stan/lib/stan_math/stan/math.hpp:19,
from stan/src/stan/model/model_header.hpp:4:
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/Map.h:142:31: note: initializing argument 1 of 'Eigen::Map<MatrixType, MapOptions, StrideType>::Map(Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType, Eigen::Index, const StrideType&) [with PlainObjectType = Eigen::Matrix<double, -1, 1>; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType = double*; Eigen::Index = long long int]'
inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType())
~~~~~~~~~~~~~~~^~~~~~~
In file included from stan/src/stan/model/model_header.hpp:8:
stan/src/stan/io/deserializer.hpp:120:30: error: invalid conversion from 'const int*' to 'Eigen::Map<Eigen::Matrix<int, -1, 1>, 0, Eigen::Stride<0, 0> >::PointerArgType' {aka 'int*'} [-fpermissive]
i_size_(data_i.size()) {}
^
In file included from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:308,
from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Dense:1,
from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22,
from stan/lib/stan_math/stan/math/rev.hpp:4,
from stan/lib/stan_math/stan/math.hpp:19,
from stan/src/stan/model/model_header.hpp:4:
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/Map.h:142:31: note: initializing argument 1 of 'Eigen::Map<MatrixType, MapOptions, StrideType>::Map(Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType, Eigen::Index, const StrideType&) [with PlainObjectType = Eigen::Matrix<int, -1, 1>; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; Eigen::Map<MatrixType, MapOptions, StrideType>::PointerArgType = int*; Eigen::Index = long long int]'
inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType())
~~~~~~~~~~~~~~~^~~~~~~
mingw32-make: *** [make/program:58: examples/bernoulli/bernoulli.exe] Error 1