Problem compiling STAN program (via brms) on HPC

Hi, I’m trying to use brms and RStan on a HPC. The code is not running - the model terminates right after attempting to compile. The below error information comes from the example from RStan package:

example(stan_model, package = 'rstan', run.dontrun = T)

The first error message says:

Error in context_eval(join(src), private$context, serialize) : 
  TypeError: Object #<Object> has no method 'imul'
  • can this be due to some unloaded libraries? (When creating my HPC workspace I load modules that seem to be necessary (e.g., clang, gcc).
  • Operating System: Linux katana3 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • brms Version: 2.16.3

Here’s the full error report:

TRANSLATING MODEL '16a540c6086086816528e4524def24d9' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model '16a540c6086086816528e4524def24d9'.
Error in context_eval(join(src), private$context, serialize) : 
  TypeError: Object #<Object> has no method 'imul'
COMPILING THE C++ CODE FOR MODEL '16a540c6086086816528e4524def24d9' NOW.
OS: x86_64, linux-gnu; rstan: 2.21.2; Rcpp: 1.0.5; inline: 0.3.15 
 >> setting environment variables: 
PKG_LIBS =  '/apps/R/gcc7/4.0.2/lib64/R/site-library/rstan/lib//libStanServices.a' -L'/apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/lib/' -lStanHeaders -L'/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppParallel/lib/' -ltbb
PKG_CPPFLAGS =   -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/Rcpp/include/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/unsupported"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/BH/include" -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/src/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppParallel/include/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1 
 >> Program source :

   1 : 
   2 : // includes from the plugin
   3 : // [[Rcpp::plugins(cpp14)]]
   4 : 
   5 : 
   6 : // user includes
   7 : #include <Rcpp.h>
   8 : #include <rstan/io/rlist_ref_var_context.hpp>
   9 : #include <rstan/io/r_ostream.hpp>
  10 : #include <rstan/stan_args.hpp>
  11 : #include <boost/integer/integer_log2.hpp>
  12 : // Code generated by Stan version 2.21.0
  
[STAN code Truncated for readability]

Compilation argument:
 /apps/R/gcc7/4.0.2/lib64/R/bin/R CMD SHLIB file114657f544571.cpp 2> file114657f544571.cpp.err.txt 
g++ -std=gnu++14 -I"/apps/R/gcc7/4.0.2/lib64/R/include" -DNDEBUG   -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/Rcpp/include/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/unsupported"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/BH/include" -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/src/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppParallel/include/"  -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1   -I/usr/local/include   -include /apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I '/apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include' -I '/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include' -fpic  -g -O2  -c file114657f544571.cpp -o file114657f544571.o
In file included from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Core:392:0,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:0:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ignoring attributes on template argument ‘__m128 {aka __vector(4) float}’ [-Wignored-attributes]
 template<> struct is_arithmetic<__m128>  { enum { value = true }; };
                                       ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:61:40: warning: ignoring attributes on template argument ‘__m128i {aka __vector(2) long long int}’ [-Wignored-attributes]
 template<> struct is_arithmetic<__m128i> { enum { value = true }; };
                                        ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:62:40: warning: ignoring attributes on template argument ‘__m128d {aka __vector(2) double}’ [-Wignored-attributes]
 template<> struct is_arithmetic<__m128d> { enum { value = true }; };
                                        ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:161:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f {aka __vector(4) float}’ [-Wignored-attributes]
 template<> struct unpacket_traits<Packet4f> { typedef float  type; enum {size=4, alignment=Aligned16}; typedef Packet4f half; };
                                           ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:162:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d {aka __vector(2) double}’ [-Wignored-attributes]
 template<> struct unpacket_traits<Packet2d> { typedef double type; enum {size=2, alignment=Aligned16}; typedef Packet2d half; };
                                           ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:163:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4i {aka __vector(2) long long int}’ [-Wignored-attributes]
 template<> struct unpacket_traits<Packet4i> { typedef int    type; enum {size=4, alignment=Aligned16}; typedef Packet4i half; };
                                           ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:718:35: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f {aka __vector(4) float}’ [-Wignored-attributes]
 struct palign_impl<Offset,Packet4f>
                                   ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:741:35: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4i {aka __vector(2) long long int}’ [-Wignored-attributes]
 struct palign_impl<Offset,Packet4i>
                                   ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:764:35: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d {aka __vector(2) double}’ [-Wignored-attributes]
 struct palign_impl<Offset,Packet2d>
                                   ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:778:34: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f {aka __vector(4) float}’ [-Wignored-attributes]
 ptranspose(PacketBlock<Packet4f,4>& kernel) {
                                  ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:783:34: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d {aka __vector(2) double}’ [-Wignored-attributes]
 ptranspose(PacketBlock<Packet2d,2>& kernel) {
                                  ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:790:34: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4i {aka __vector(2) long long int}’ [-Wignored-attributes]
 ptranspose(PacketBlock<Packet4i,4>& kernel) {
                                  ^
In file included from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Core:374:0,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:0:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/Default/ConjHelper.h:15:70: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f {aka __vector(4) float}’ [-Wignored-attributes]
   template<> struct conj_helper<PACKET_REAL, PACKET_CPLX, false,false> {                                          \
                                                                      ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/Complex.h:232:1: note: in expansion of macro ‘EIGEN_MAKE_CONJ_HELPER_CPLX_REAL’
 EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/Default/ConjHelper.h:22:70: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f {aka __vector(4) float}’ [-Wignored-attributes]
   template<> struct conj_helper<PACKET_CPLX, PACKET_REAL, false,false> {                                          \
                                                                      ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/Complex.h:232:1: note: in expansion of macro ‘EIGEN_MAKE_CONJ_HELPER_CPLX_REAL’
 EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/Default/ConjHelper.h:15:70: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d {aka __vector(2) double}’ [-Wignored-attributes]
   template<> struct conj_helper<PACKET_REAL, PACKET_CPLX, false,false> {                                          \
                                                                      ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/Complex.h:417:1: note: in expansion of macro ‘EIGEN_MAKE_CONJ_HELPER_CPLX_REAL’
 EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/Default/ConjHelper.h:22:70: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d {aka __vector(2) double}’ [-Wignored-attributes]
   template<> struct conj_helper<PACKET_CPLX, PACKET_REAL, false,false> {                                          \
                                                                      ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/Complex.h:417:1: note: in expansion of macro ‘EIGEN_MAKE_CONJ_HELPER_CPLX_REAL’
 EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Core:367:0,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:0:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h: In instantiation of ‘struct Eigen::internal::find_best_packet<float, 4>’:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/Matrix.h:22:57:   required from ‘struct Eigen::internal::traits<Eigen::Matrix<float, 4, 1> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:224:7:   required from ‘struct Eigen::internal::traits<Eigen::Quaternion<float> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:24:46:   required from here
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:170:44: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<float>::type {aka __vector(4) float}’ [-Wignored-attributes]
          bool Stop = Size==Dynamic || (Size%unpacket_traits<PacketType>::size)==0 || is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
                                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:170:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<float>::type {aka __vector(4) float}’ [-Wignored-attributes]
          bool Stop = Size==Dynamic || (Size%unpacket_traits<PacketType>::size)==0 || is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:170:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<float>::type {aka __vector(4) float}’ [-Wignored-attributes]
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:170:83: warning: ignoring attributes on template argument ‘Eigen::internal::unpacket_traits<__vector(4) float>::half {aka __vector(4) float}’ [-Wignored-attributes]
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:188:88: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<float>::type {aka __vector(4) float}’ [-Wignored-attributes]
   typedef typename find_best_packet_helper<Size,typename packet_traits<T>::type>::type type;
                                                                                        ^~~~
In file included from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Core:434:0,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:0:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h: In instantiation of ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 0>’:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:300:7:   required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 1>’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:551:7:   required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 3>’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseBase.h:41:34:   required from ‘class Eigen::DenseBase<Eigen::Matrix<float, 4, 1> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/MatrixBase.h:48:34:   required from ‘class Eigen::MatrixBase<Eigen::Matrix<float, 4, 1> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/PlainObjectBase.h:98:7:   required from ‘class Eigen::PlainObjectBase<Eigen::Matrix<float, 4, 1> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/Matrix.h:178:7:   required from ‘class Eigen::Matrix<float, 4, 1>’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:46:50:   required from ‘class Eigen::QuaternionBase<Eigen::Quaternion<float> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:232:7:   required from ‘class Eigen::Quaternion<float>’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:27:3:   required from here
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<float>::type {aka __vector(4) float}’ [-Wignored-attributes]
                      >::type PacketReturnType;
                              ^~~~~~~~~~~~~~~~
In file included from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Core:367:0,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:0:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h: In instantiation of ‘struct Eigen::internal::find_best_packet<double, 4>’:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/Matrix.h:22:57:   required from ‘struct Eigen::internal::traits<Eigen::Matrix<double, 4, 1> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:224:7:   required from ‘struct Eigen::internal::traits<Eigen::Quaternion<double> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:88:47:   required from here
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:170:44: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type {aka __vector(2) double}’ [-Wignored-attributes]
          bool Stop = Size==Dynamic || (Size%unpacket_traits<PacketType>::size)==0 || is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
                                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:170:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type {aka __vector(2) double}’ [-Wignored-attributes]
          bool Stop = Size==Dynamic || (Size%unpacket_traits<PacketType>::size)==0 || is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:170:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type {aka __vector(2) double}’ [-Wignored-attributes]
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:170:83: warning: ignoring attributes on template argument ‘Eigen::internal::unpacket_traits<__vector(2) double>::half {aka __vector(2) double}’ [-Wignored-attributes]
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:188:88: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type {aka __vector(2) double}’ [-Wignored-attributes]
   typedef typename find_best_packet_helper<Size,typename packet_traits<T>::type>::type type;
                                                                                        ^~~~
In file included from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Core:434:0,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:0:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h: In instantiation of ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 0>’:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:300:7:   required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 1>’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:551:7:   required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 3>’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseBase.h:41:34:   required from ‘class Eigen::DenseBase<Eigen::Matrix<double, 4, 1> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/MatrixBase.h:48:34:   required from ‘class Eigen::MatrixBase<Eigen::Matrix<double, 4, 1> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/PlainObjectBase.h:98:7:   required from ‘class Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/Matrix.h:178:7:   required from ‘class Eigen::Matrix<double, 4, 1>’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:46:50:   required from ‘class Eigen::QuaternionBase<Eigen::Quaternion<double> >’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:232:7:   required from ‘class Eigen::Quaternion<double>’
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:92:3:   required from here
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type {aka __vector(2) double}’ [-Wignored-attributes]
                      >::type PacketReturnType;
                              ^~~~~~~~~~~~~~~~
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make: *** [file114657f544571.o] Error 4

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

Program source:
  1: 
  2: // includes from the plugin
  3: // [[Rcpp::plugins(cpp14)]]
  4: 
  5: 
  6: // user includes
  7: #include <Rcpp.h>
  8: #include <rstan/io/rlist_ref_var_context.hpp>
  9: #include <rstan/io/r_ostream.hpp>
 10: #include <rstan/stan_args.hpp>
 11: #include <boost/integer/integer_log2.hpp>
 12: // Code generated by Stan version 2.21.0
 13: 
 14: #include <stan/model/model_header.hpp>
 15: 
 16: namespace model11465b8d04a1_16a540c6086086816528e4524def24d9_namespace {
 17: 
 18: using std::istream;
 19: using std::string;
 20: using std::stringstream;
 21: using std::vector;
 22: using stan::io::dump;
 23: using stan::math::lgamma;
 24: using stan::model::prob_grad;
 25: using namespace stan::math;
 26: 
 27: static int current_statement_begin__;
 28: 
 29: stan::io::program_reader prog_reader__() {
 30:     stan::io::program_reader reader;
 31:     reader.add_event(0, 0, "start", "model11465b8d04a1_16a540c6086086816528e4524def24d9");
 32:     reader.add_event(3, 1, "end", "model11465b8d04a1_16a540c6086086816528e4524def24d9");
 33:     return reader;
 34: }
 
[STAN code Truncated for readability]


Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Core:392:0,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /apps/R/gcc7/4.0.2/lib64/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:0:
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ignoring attributes on template argument ‘__m128 {aka __vector(4) float}’ [-Wignored-attributes]
 template<> struct is_arithmetic<__m128>  { enum { value = true }; };
                                       ^
/apps/R/gcc7/4.0.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:61:40: warning: ignoring attributes on template argument ‘__m128i {aka __vector(2) long long int}’ [-Wignored-attributes]
 template<> struct is_arithmetic<__m128i

That error appears to be javascript-related. Can you try running:

rstan_options(javascript=FALSE)

Before your model call?

Thanks - it seems to remove the javascript-linked problem, but throws another one:

Compiling Stan program...

Error in compileCode(f, code, language = language, verbose = verbose) :

Compilation ERROR, function(s)/method(s) not created! g++: internal compiler error: Killed (program cc1plus)

Please submit a full bug report,

with preprocessed source if appropriate.

See <https://gcc.gnu.org/bugs/> for instructions.

make: *** [file3f6f316eb2324.o] Error 4

In addition: Warning message:

In system(cmd, intern = !verbose) :

running command '/apps/R/gcc7/4.0.2/lib64/R/bin/R CMD SHLIB file3f6f316eb2324.cpp 2> file3f6f316eb2324.cpp.err.txt' had status 1

Error in sink(type = "output") : invalid connection

Looks like there might be an issue with your compiler. Can you try running this Rcpp example model to see if you can compile c++:

Rcpp::sourceCpp(code='
  #include <Rcpp.h>

  // [[Rcpp::export]]
  int fibonacci(const int x) {
    if (x == 0) return(0);
    if (x == 1) return(1);
    return (fibonacci(x - 1)) + fibonacci(x - 2);
  }'
,verbose=T)

Yes, it compiles and works after compiling:

Generated extern "C" functions 
--------------------------------------------------------


#include <Rcpp.h>
// fibonacci
int fibonacci(const int x);
RcppExport SEXP sourceCpp_1_fibonacci(SEXP xSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< const int >::type x(xSEXP);
    rcpp_result_gen = Rcpp::wrap(fibonacci(x));
    return rcpp_result_gen;
END_RCPP
}

Generated R functions 
-------------------------------------------------------

`.sourceCpp_1_DLLInfo` <- dyn.load('/tmp/RtmpkgyrYV/sourceCpp-x86_64-pc-linux-gnu-1.0.5/sourcecpp_21306f7ccc68/sourceCpp_2.so')

fibonacci <- Rcpp:::sourceCppFunction(function(x) {}, FALSE, `.sourceCpp_1_DLLInfo`, 'sourceCpp_1_fibonacci')

rm(`.sourceCpp_1_DLLInfo`)

Building shared library
--------------------------------------------------------

DIR: /tmp/RtmpkgyrYV/sourceCpp-x86_64-pc-linux-gnu-1.0.5/sourcecpp_21306f7ccc68

/apps/R/gcc7/4.0.2/lib64/R/bin/R CMD SHLIB -o 'sourceCpp_2.so' 'file21307788cfff.cpp' 
g++ -std=gnu++11 -I"/apps/R/gcc7/4.0.2/lib64/R/include" -DNDEBUG   -I"/apps/R/gcc7/4.0.2/lib64/R/site-library/Rcpp/include" -I"/tmp/RtmpkgyrYV/sourceCpp-x86_64-pc-linux-gnu-1.0.5" -I/usr/local/include   -fpic  -g -O2  -c file21307788cfff.cpp -o file21307788cfff.o
g++ -std=gnu++11 -shared -L/apps/R/gcc7/4.0.2/lib64/R/lib -Wl,-rpath=/apps/gcc/7.5.0/lib -Wl,-rpath=/apps/gcc/7.5.0/lib64 -Wl,-rpath=/apps/R/gcc7/4.0.2/lib64/R/lib -o sourceCpp_2.so file21307788cfff.o -Wl,-rpath=/apps/R/gcc7/4.0.2/lib64/R/lib -Wl,-rpath,/apps/gcc/7.5.0/lib -Wl,-rpath,/apps/gcc/7.5.0/lib64 -L/apps/R/gcc7/4.0.2/lib64/R/lib -lR
> fibonacci
function (x) 
.Call(<pointer: 0x7f049d164bb0>, x)
> fibonacci(4)
[1] 3
> fibonacci(8)
[1] 21

So it looks like an issue on the rstan side then. Can you try the preview of the next rstan version, to see if that helps:

remove.packages(c("StanHeaders", "rstan"))
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

Hi, I was on holidays, hence late reply - thanks a lot for your suggestion, it worked and STAN properly reinstalled itself in a personal library on my HPC account. I really appreciate your help.

Best
szymek