Failing to make example/bernoulli/bernoulli on CmdStan fresh installation

I fresh installed CmdStan using these instructions, following the git clone procedure on MacOS BigSur 11.2.3. When I compile the example to check whether the installation was successful, I get the following error:

$ make examples/bernoulli/bernoulli
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2019_U8/include   -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_5.6.1/include    -DBOOST_DISABLE_ASSERTS         -c -MT stan/src/stan/model/model_header.hpp.gch -MT stan/src/stan/model/model_header.d -MM -E -MG -MP -MF stan/src/stan/model/model_header.d stan/src/stan/model/model_header.hpp
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2019_U8/include   -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_5.6.1/include    -DBOOST_DISABLE_ASSERTS         -c -MT src/cmdstan/main.o -MM -E -MG -MP -MF src/cmdstan/main.d src/cmdstan/main.cpp

--- Translating Stan model to C++ code ---
bin/stanc  --o=examples/bernoulli/bernoulli.hpp examples/bernoulli/bernoulli.stan

--- Compiling, linking C++ code ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2019_U8/include   -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_5.6.1/include    -DBOOST_DISABLE_ASSERTS         -c -include-pch stan/src/stan/model/model_header.hpp.gch -x c++ -o examples/bernoulli/bernoulli.o examples/bernoulli/bernoulli.hpp
In file included from examples/bernoulli/bernoulli.hpp:1:
In file included from stan/src/stan/model/model_header.hpp:13:
/Users/felipe/cmdstan/stan/src/stan/model/model_base_crtp.hpp:206:50: error: 'transform_inits' following the 'template' keyword does not refer to a
      template
    return static_cast<const M*>(this)->template transform_inits(
                                                 ^
/Users/felipe/cmdstan/stan/src/stan/model/model_base_crtp.hpp:86:11: note: in instantiation of member function
      'stan::model::model_base_crtp<bernoulli_model_namespace::bernoulli_model>::transform_inits' requested here
  virtual ~model_base_crtp() {}
          ^
examples/bernoulli/bernoulli.hpp:38:3: note: in instantiation of member function
      'stan::model::model_base_crtp<bernoulli_model_namespace::bernoulli_model>::~model_base_crtp' requested here
  ~bernoulli_model() { }
  ^
examples/bernoulli/bernoulli.hpp:335:17: note: declared as a non-template here
    inline void transform_inits(const stan::io::var_context& context,
                ^
1 error generated.
make: *** [examples/bernoulli/bernoulli] Error 1

My compiler and make versions are

$ clang++ --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
(...)

$ make --version
GNU Make 3.81
(...)

I also tried checking out from develop to release/v2.26.1 branch, but the error persists. However, compilation of the example bernoulli model is successful if I decompress this tarball and work from there.

While this does not prevents me from using stan, it is weird that I can’t build from the git repo. Any thoughts on what I might be doing wrong?

Hi, this is an issue with current develop,one of the change in the last few days do not work with recent versions of clang, I think this one might be causing it: Adds Serializer and virtual functions for new transform inits by SteveBronder · Pull Request #3019 · stan-dev/stan · GitHub

We are working on fixing it.

Our tests run with various versions of g++ and with clang+±6.0.

1 Like