This compilation error in brms?

Please also provide the following information in addition to your question:

  • Operating System: Debian GNU/Linux 9.9 (stretch)
  • brms Version: 2.6.0

Hello, I installed R and all its packages via miniconda. After installing the package “brms”, I found that the package worked normally if inputing brms codes. However, after upgrading the version of anaconda, the package did not work just showing " C++ compiling…" but did not show the compiler result. So I installed “Rstanarm” after searching in the internet. However, the problem became more serious. After running brms codes, unbearably long output came out. I really cannot solve the problem. It will be greatly appreciated if you kindly give me some help.
Compiling the C++ model
clang: warning: -Wl,-rpath-link,/home/kun/miniconda3/lib: ‘linker’ input unused
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:145:10: warning: ‘auto’ type specifier is a C++11 extension [-Wc++11-extensions]
for (auto& block : blocks_)
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:145:22: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
for (auto& block : blocks_)
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core.hpp:4:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:47:69: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
AutodiffStackStorage &operator=(const AutodiffStackStorage &) = delete;
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:60:30: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
AutodiffStackSingleton() = delete;
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:61:71: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
explicit AutodiffStackSingleton(AutodiffStackSingleton_t const &) = delete;
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:62:73: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
AutodiffStackSingleton &operator=(const AutodiffStackSingleton_t &) = delete;
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core.hpp:5:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/build_vari_array.hpp:5:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/var.hpp:7:
In file included from /home/kun/miniconda3/lib/R/library/BH/include/boost/math/tools/config.hpp:13:
In file included from /home/kun/miniconda3/lib/R/library/BH/include/boost/config.hpp:39:
/home/kun/miniconda3/lib/R/library/BH/include/boost/config/compiler/clang.hpp:204:11: warning: ‘BOOST_NO_CXX11_RVALUE_REFERENCES’ macro redefined [-Wmacro-redefined]

define BOOST_NO_CXX11_RVALUE_REFERENCES

      ^

:6:9: note: previous definition is here
#define BOOST_NO_CXX11_RVALUE_REFERENCES 1
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core.hpp:5:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/build_vari_array.hpp:5:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/var.hpp:56:63: error: use of undeclared identifier ‘nullptr’
bool is_uninitialized() { return (vi_ == static_cast<vari*>(nullptr)); }
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/var.hpp:473:18: error: use of undeclared identifier ‘nullptr’
if (v.vi_ == nullptr)
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core.hpp:43:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/recover_memory.hpp:25:8: warning: ‘auto’ type specifier is a C++11 extension [-Wc++11-extensions]
for (auto &x : ChainableStack::instance().var_alloc_stack_) {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core/recover_memory.hpp:25:16: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
for (auto &x : ChainableStack::instance().var_alloc_stack_) {
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/core.hpp:45:
/home/kun/miniconda3/lib/R/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_)
^
/home/kun/miniconda3/lib/R/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_)
^
/home/kun/miniconda3/lib/R/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_)
^
/home/kun/miniconda3/lib/R/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_)
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:7:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat/meta/operands_and_partials.hpp:7:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/scal/meta/operands_and_partials.hpp:9:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/scal/meta/operands_and_partials.hpp:5:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/scal/meta/return_type.hpp:32:31: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template <typename T, typename… Types_pack>
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:11:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat/vectorize/apply_scalar_unary.hpp:4:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/vectorize/apply_scalar_unary.hpp:58:9: error: expected expression
[](scalar_t x) { return apply_scalar_unary<F, scalar_t>::apply(x); });
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat.hpp:9:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_array_or_scalar.hpp:21:5: error: expected expression
const Eigen::Matrix<T, R, C>& v) {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_array_or_scalar.hpp:21:35: error: use of undeclared identifier ‘v’
const Eigen::Matrix<T, R, C>& v) {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_array_or_scalar.hpp:36:64: warning: use of right-shift operator (’>>’) in template argument will require parentheses in C++11 [-Wc++11-compat]
as_array_or_scalar(const Eigen::Map<const Eigen::Matrix<T, R, C>>& v) {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_array_or_scalar.hpp:36:68: error: use of undeclared identifier ‘v’
as_array_or_scalar(const Eigen::Map<const Eigen::Matrix<T, R, C>>& v) {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_array_or_scalar.hpp:54:1: error: expected ‘)’
} // namespace math
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_array_or_scalar.hpp:36:19: note: to match this ‘(’
as_array_or_scalar(const Eigen::Map<const Eigen::Matrix<T, R, C>>& v) {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_array_or_scalar.hpp:52:2: error: expected ‘;’ at end of declaration
}
^
;
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat.hpp:10:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_column_vector_or_scalar.hpp:34:28: error: expected expression
as_column_vector_or_scalar(const Eigen::Matrix<T, 1, Eigen::Dynamic>& a) {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_column_vector_or_scalar.hpp:34:71: error: use of undeclared identifier ‘a’
as_column_vector_or_scalar(const Eigen::Matrix<T, 1, Eigen::Dynamic>& a) {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/as_column_vector_or_scalar.hpp:55:1: error: expected unqualified-id
} // namespace math
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat.hpp:15:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/is_constant_struct.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/arr/meta/is_constant_struct.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:4:
In file included from /usr/bin/…/lib/gcc/x86_64-linux-gnu/6.3.0/…/…/…/…/include/c++/6.3.0/type_traits:35:
/usr/bin/…/lib/gcc/x86_64-linux-gnu/6.3.0/…/…/…/…/include/c++/6.3.0/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat.hpp:15:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/is_constant_struct.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/arr/meta/is_constant_struct.hpp:4:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:27:18: error: no template named ‘is_convertible’ in namespace ‘std’; did you mean ‘boost::is_convertible’?
enum { value = std::is_convertible<T, double>::value };
^~~~~~~~~~~~~~~~~~~
boost::is_convertible
/home/kun/miniconda3/lib/R/library/BH/include/boost/type_traits/is_convertible.hpp:490:8: note: ‘boost::is_convertible’ declared here
struct is_convertible : public integral_constant<bool, BOOST_IS_CONVERTIBLE(From, To)>
^
In file included from file598023aba34b.cpp:8:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math.hpp:4:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat.hpp:20:
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/operands_and_partials.hpp:19:59: error: expected expression
class ops_partials_edge<ViewElt, Eigen::Matrix<Op, R, C>> {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/operands_and_partials.hpp:35:2: error: expected a type
};
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/operands_and_partials.hpp:38:70: error: expected expression
class ops_partials_edge<ViewElt, std::vector<Eigen::Matrix<Op, R, C>>> {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/operands_and_partials.hpp:38:72: error: expected a type
class ops_partials_edge<ViewElt, std::vector<Eigen::Matrix<Op, R, C>>> {
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/operands_and_partials.hpp:54:2: error: expected a type
};
^
/home/kun/miniconda3/lib/R/library/StanHeaders/include/stan/math/prim/mat/meta/operands_and_partials.hpp:57:60: error: a space is required between consecutive right angle brackets (use ‘> >’)
class ops_partials_edge<ViewElt, std::vector<std::vector>> {
^~
> >
fatal error: too many errors emitted, stopping now [-ferror-limit=]
15 warnings and 20 errors generated.
make: *** [/home/kun/miniconda3/lib/R/etc/Makeconf:167: file598023aba34b.o] Error 1

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
1:
2: // includes from the plugin
3:
4:
5: // user includes
6: #define STAN__SERVICES__COMMAND_HPP// Code generated by Stan version 2.17.0
7:
8: #include <stan/model/model_header.hpp>
9:
10: namespace model59802545cc16_cb9ddb72e4164d466507acf604c2e275_namespace {
11:
12: using std::istream;
13: using std::string;
14: using std::stringstream;
15: using std::vector;
16: using stan::io::dump;
17: using stan::math::lgamma;
18: using stan::model::prob_grad;
19: using namespace stan::math;
20:
21: typedef Eigen::Matrix<double,Eigen::Dynamic,1> vector_d;
22: typedef Eigen::Matrix<double,1,Eigen::Dynamic> row_vector_d;
23: typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> matrix_d;
24:
25: static int current_statement_begin__;
26:
27: stan::io::program_reader prog_reader__() {
28: stan::io::program_reader reader;
29: reader.add_event(0, 0, “start”, “model59802545cc16_cb9ddb72e4164d466507acf604c2e275”);
30: reader.add_event(103, 103, “end”, “model59802545cc16_cb9ddb72e4164d466507acf604c2e275”);
31: return reader;
32: }
33:
34: template <bool propto, typename T1__, typename T2__, typename T3__>
35: typename boost::math::tools::promote_args<T1__, T2__, T3__>::type
36: cumulative_logit_lpmf(const int& y,
37: const T1__& mu,
38: const Eigen::Matrix<T2__, Eigen::Dynamic,1>& thres,
39: const T3__& disc, std::ostream* pstream__) {
40: typedef typename boost::math::tools::promote_args<T1__, T2__, T3__>::type fun_scalar_t__;
41: typedef fun_scalar_t__ fun_return_scalar_t__;
42: const static bool propto__ = true;
43: (void) propto__;
44: fun_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());
45: (void) DUMMY_VAR__; // suppress unused var warning

There are 924 remaining lines which I did not display.

Using Stan via R via miniconda is usually bad news. I would install R from the Debian repositories, at which point you could do

apt-get install r-cran-rstan

followed by


Otherwise, you have to convince the miniconda install to respect the compilation flags in the previous link.

Thank you very much!
It worked after I followed the tip. Although the direct installation by the use of apt-get in my system, a configuration file for the C++ toolchain, removing Rstand and re-installation make brms codes work.
You helped me a lot!