Hello,
This is my first time trying to use cmdstanr. My goal is to get the 2.30.0-rc1 version working, but for now I am just trying to use the latest stable release (2.29.2).
So far I am unable to compile a model from the examples folder.
Here are system details:
Windows 11
R 4.2.1
cmdstanr version 0.5.2 (installed using remotes::install_github("stan-dev/cmdstanr")
)
rtools42
Here’s the code:
library(cmdstanr)
cmdstanr::set_cmdstan_path(file.path("C:/Users/gscot/.cmdstan", "cmdstan-2.29.2"))
model <-
cmdstan_model(
file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan")
)
model$compile(force_recompile = TRUE)
And here’s the error message:
Compiling Stan program...
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/multi_array/multi_array_ref.hpp:32,
from stan/lib/stan_math/lib/boost_1.75.0/boost/multi_array.hpp:34,
from stan/lib/stan_math/lib/boost_1.75.0/boost/numeric/odeint/algebra/multi_array_algebra.hpp:22,
from stan/lib/stan_math/lib/boost_1.75.0/boost/numeric/odeint.hpp:63,
from stan/lib/stan_math/stan/math/prim/functor/ode_rk45.hpp:9,
from stan/lib/stan_math/stan/math/prim/functor/integrate_ode_rk45.hpp:6,
from stan/lib/stan_math/stan/math/prim/functor.hpp:14,
from stan/lib/stan_math/stan/math/rev/fun.hpp:194,
from stan/lib/stan_math/stan/math/rev.hpp:10,
from stan/lib/stan_math/stan/math.hpp:19,
from stan/src/stan/model/model_header.hpp:4,
from C:/Users/gscot/AppData/Local/Temp/RtmpcRHWyh/model-2c105b6d6b21.hpp:3:
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:180:45: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
180 | : public boost::functional::detail::unary_function<typename unary_traits<Predicate>::argument_type,bool>
| ^~~~~~~~~~~~~~
In file included from C:/rtools42/ucrt64/include/c++/12.1.0/string:48,
from C:/rtools42/ucrt64/include/c++/12.1.0/bits/locale_classes.h:40,
from C:/rtools42/ucrt64/include/c++/12.1.0/bits/ios_base.h:41,
from C:/rtools42/ucrt64/include/c++/12.1.0/ios:42,
from C:/rtools42/ucrt64/include/c++/12.1.0/istream:38,
from C:/rtools42/ucrt64/include/c++/12.1.0/sstream:38,
from C:/rtools42/ucrt64/include/c++/12.1.0/complex:45,
from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:96,
from stan/lib/stan_math/lib/eigen_3.3.9/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:
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:214:45: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
214 | : public boost::functional::detail::binary_function<
| ^~~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:252:45: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
252 | : public boost::functional::detail::unary_function<
| ^~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:299:45: warning: 'template<cl
ass _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
299 | : public boost::functional::detail::unary_function<
| ^~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:345:57: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
345 | class mem_fun_t : public boost::functional::detail::unary_function<T*, S>
| ^~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:361:58: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
361 | class mem_fun1_t : public boost::functional::detail::binary_function<T*, A, S>
| ^~~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:377:63: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
377 | class const_mem_fun_t : public boost::functional::detail::unary_function<const T*, S>
| ^~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:393:64: warning:
'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
393 | class const_mem_fun1_t : public boost::functional::detail::binary_function<const T*, A, S>
| ^~~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:438:61: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
438 | class mem_fun_ref_t : public boost::functional::detail::unary_function<T&, S>
| ^~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:454:62: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
454 | class mem_fun1_ref_t : public boost::functional::detail::binary_function<T&, A, S>
| ^~~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:470:67: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
470 | class const_mem_fun_ref_t : public boost::functional::detail::unary_function<const T&, S>
| ^~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:487:68: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
487 | class const_mem_fun1_ref_t : public boost::functional::detail::binary_function<const T&, A, S>
| ^~~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:533:73: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
533 | class pointer_to_unary_function : public boost::functional::detail::unary_function<Arg,Result>
| ^~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.75.0/boost/functional.hpp:557:74: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
557 | class pointer_to_binary_function : public boost::functional::detail::binary_function<Arg1,Arg2,Result>
| ^~~~~~~~~~~~~~~
C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:195:
In function '__m128d _mm_loadu_pd(const double*)',
inlined from 'Packet Eigen::internal::ploadu(const typename unpacket_traits<Packet>::type*) [with Packet = __vector(2) double]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/arch/SSE/PacketMath.h:336:22,
inlined from 'Packet Eigen::internal::ploadt(const typename unpacket_traits<Packet>::type*) [with Packet = __vector(2) double; int Alignment = 0]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/GenericPacketMath.h:462:26,
inlined from 'PacketType Eigen::internal::mapbase_evaluator<Derived, PlainObjectType>::packet(Eigen::Index) const [with int LoadMode = 0; PacketType = __vector(2) double; Derived = Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >; PlainObjectType = Eigen::Matrix<double, -1, 1>]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/CoreEvaluators.h:867:50,
inlined from 'void Eigen::internal::generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>::assignPacket(Eigen::Index) [with int StoreMode = 16; int LoadMode = 0; PacketType = __vector(2) double; DstEvaluatorTypeT = Eigen::internal::evaluator<Eigen::Matrix<double, -1, 1> >; SrcEvaluatorTypeT = Eigen::internal::evaluator<Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> > >; Functor = Eigen::internal::assign_op<double, double>; int Version = 0]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/AssignEvaluator.h:658:114,
inlined from 'static void Eigen::internal::dense_assignment_loop<Kernel, 3, 0>::run(Kernel&) [with Kernel = Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Matrix<double, -1, 1> >, Eigen::internal::evaluator<Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> > >, Eigen::internal::assign_op<double, double>, 0>]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/AssignEvaluator.h:416:75,
inlined from 'void Eig
en::internal::call_dense_assignment_loop(DstXprType&, const SrcXprType&, const Functor&) [with DstXprType = Eigen::Matrix<double, -1, 1>; SrcXprType = Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >; Functor = assign_op<double, double>]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/AssignEvaluator.h:741:37,
inlined from 'static void Eigen::internal::Assignment<DstXprType, SrcXprType, Functor, Eigen::internal::Dense2Dense, Weak>::run(DstXprType&, const SrcXprType&, const Functor&) [with DstXprType = Eigen::Matrix<double, -1, 1>; SrcXprType = Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >; Functor = Eigen::internal::assign_op<double, double>; Weak = void]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/AssignEvaluator.h:879:31,
inlined from 'void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Matrix<double, -1, 1>; Src = Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >; Func = assign_op<double, double>]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/AssignEvaluator.h:836:49,
inlined from 'void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename enable_if<(! evaluator_assume_aliasing<Src>::value), void*>::type) [with Dst = Eigen::Matrix<double, -1, 1>; Src = Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >; Func = assign_op<double, double>]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/AssignEvaluator.h:804:27,
inlined from 'void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Matrix<double, -1, 1>; Src = Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/AssignEvaluator.h:782:18,
inlined from 'Derived& Eigen::PlainObjectBase<Derived>::_set(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >; Derived = Eigen::Matrix<double,
-1, 1>]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/PlainObjectBase.h:714:32,
inlined from 'Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::operator=(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >; _Scalar = double; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = -1; int _MaxCols = 1]' at stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/Matrix.h:225:24,
inlined from 'void bernoulli_model_namespace::bernoulli_model::write_array(RNG&, Eigen::Matrix<double, -1, 1>&, Eigen::Matrix<double, -1, 1>&, bool, bool, std::ostream*) const [with RNG = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >]' at C:/Users/gscot/AppData/Local/Temp/RtmpcRHWyh/model-2c105b6d6b21.hpp:263:12,
inlined from 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, Eigen::VectorXd&, Eigen::VectorXd&, bool, bool, std::ostream*) const [with M = bernoulli_model_namespace::bernoulli_model]' at stan/src/stan/model/model_base_crtp.hpp:137:61:
C:/rtools42/ucrt64/lib/gcc/x86_64-w64-mingw32/12.1.0/include/emmintrin.h:131:24: warning: array subscript '__m128d_u[0]' is partly outside array bounds of 'unsigned char [8]' [-Warray-bounds]
131 | return *(__m128d_u *)__P;
| ^~~
In file included from C:/rtools42/ucrt64/include/c++/12.1.0/x86_64-w64-mingw32/bits/c++allocator.h:33,
from C:/rtools42/ucrt64/include/c++/12.1.0/bits/allocator.h:46,
from C:/rtools42/ucrt64/include/c++/12.1.0/string:41:
In member function '_Tp* std::__new_allocator<_Tp>::allocate(size_type, const void*) [with _Tp = double]',
inlined from 'static _Tp* std::allocator_traits<std::allocator<_CharT> >::allocate(allocator_type&, size_type) [with _Tp = double]' at C:/rtools42/ucrt64/include/c++/12.1.0/bits/alloc_traits.h:464:28,
inlined from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = double; _Alloc = std::allocator<double>]' at C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_vector.h:378:33,
inlined from 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = double; _Alloc = std::allocator<double>]' at C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_vector.h:395:44,
inlined from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = double; _Alloc = std::allocator<double>]' at C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_vector.h:332:26,
inlined from 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = double; _Alloc = std::allocator<double>]' at C:/rtools42/ucrt64/include/c++/12.1.0/bits/stl_vector.h:552:47,
inlined from 'void bernoulli_model_namespace::bernoulli_model::write_array(RNG&, Eigen::Matrix<double, -1, 1>&, Eigen::Matrix<double, -1, 1>&, bool, bool, std::ostream*) const [with RNG = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >]' at C:/Users/gscot/AppData/Local/Temp/RtmpcRHWyh/model-2c105b6d6b21.hpp:257:27,
inlined from 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988
&, Eigen::VectorXd&, Eigen::VectorXd&, bool, bool, std::ostream*) const [with M = bernoulli_model_namespace::bernoulli_model]' at stan/src/stan/model/model_base_crtp.hpp:137:61:
C:/rtools42/ucrt64/include/c++/12.1.0/bits/new_allocator.h:137:55: note: object of size 8 allocated by 'operator new'
137 | return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp)));
| ^
C:/rtools42/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe
:
src/cmdstan/main.o:main.cpp:(.text$_ZN4stan2io15stan_csv_reader13read_metadataERSiRNS0_17stan_csv_metadataEPSo[_ZN4stan2io15stan_csv_reader13read_metadataERSiRNS0_17stan_csv_metadataEPSo]+0xe3): undefined reference to `std::istream::seekg(std::fpos<int>)'
C:/rtools42/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
src/cmdstan/main.o
:main.cpp:(.text$_ZN4stan2io15stan_csv_reader15read_adaptationERSiRNS0_19stan_csv_adaptationEPSo[_ZN4stan2io15stan_csv_reader15read_adaptationERSiRNS0_19stan_csv_adaptationEPSo]+0x164): undefined reference to `std::istream::seekg(std::fpos<int>)'
C:/rtools42/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
src/cmdstan/main.o:main.cpp:(.text$_ZN4stan2io15stan_csv_reader12read_samplesERSiRN5Eigen6MatrixIdLin1ELin1ELi0ELin1ELin1EEERNS0_15stan_csv_timingEPSo[_ZN4stan2io15stan_csv_reader12read_samplesERSiRN5Eigen6MatrixIdLin1ELin1ELi0ELin1ELin1EEERNS0_15stan_csv_timingEPSo]+0x74d): undefined reference to `std::istream::seekg(std::fpos<int>)'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [make/program:59: C:\Users\gscot\AppData\Local\Temp\RtmpcRHWyh\model-2c105b6d6b21.exe] Error 1
Error: An error occured during compilation! See the message above for more information.
I also ran check_cmdstan_toolchain()
check_cmdstan_toolchain()
The C++ toolchain required for CmdStan is setup properly!
Thank you,
Scott