kgori / sigfit

Flexible Bayesian inference of mutational signatures
GNU General Public License v3.0
33 stars 8 forks source link

C++11 required for latest StanHeaders (2.18) #36

Closed kgori closed 5 years ago

kgori commented 5 years ago

Can't build against Stan v2.18 because it has introduced C++11-only features. Suggested fix: add CXX_STD = CXX11 to sigfit/src/Makevars.

Currently, attempting to build produces a mixture of warnings:

In file included from Modules.cpp:3:
In file included from ./include/models.hpp:5:
In file included from /Users/kg8/Library/R/3.5/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Users/kg8/Library/R/3.5/library/rstan/include/rstan/stan_fit.hpp:34:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/model/test_gradients.hpp:7:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/rev/core.hpp:44:
/Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:15:8: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  for (auto &x : ChainableStack::instance().var_stack_)
       ^
/Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:15:16: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
  for (auto &x : ChainableStack::instance().var_stack_)
               ^
/Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:17:8: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
  for (auto &x : ChainableStack::instance().var_nochain_stack_)
       ^
/Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:17:16: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
  for (auto &x : ChainableStack::instance().var_nochain_stack_)
               ^

and errors:

In file included from Modules.cpp:3:
In file included from ./include/models.hpp:5:
In file included from /Users/kg8/Library/R/3.5/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Users/kg8/Library/R/3.5/library/rstan/include/rstan/stan_fit.hpp:34:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/model/test_gradients.hpp:7:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/prim/mat.hpp:156:
/Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/prim/mat/fun/log_mix.hpp:178:26: error: expected expression
              .unaryExpr([](T_partials_return x) { return exp(x); });
                         ^
/Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/prim/mat/fun/log_mix.hpp:262:24: error: expected expression
            .unaryExpr([](T_partials_return x) { return exp(x); });
                       ^
In file included from Modules.cpp:3:
In file included from ./include/models.hpp:5:
In file included from /Users/kg8/Library/R/3.5/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Users/kg8/Library/R/3.5/library/rstan/include/rstan/stan_fit.hpp:34:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/model/test_gradients.hpp:7:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/prim/mat.hpp:162:
In file included from /Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/prim/mat/fun/matrix_exp_multiply.hpp:5:
/Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/prim/mat/fun/matrix_exp_action_handler.hpp:20:10: error: unknown type name 'constexpr'
  static constexpr int p_max = 8;
         ^
/Users/kg8/Library/R/3.5/library/StanHeaders/include/stan/math/prim/mat/fun/matrix_exp_action_handler.hpp:20:20: error: expected member name or ';' after declaration specifiers
  static constexpr int p_max = 8;
  ~~~~~~~~~~~~~~~~ ^
kgori commented 5 years ago

Fixed in 90fcfb1