Attempting to compile model methods fails with three errors that seem to stem from ambiguity in tbb::split (full text below). The same model successfully compiles when compile_model_methods = FALSE. This is preventing me from using Aki Vehtari’s functions for using Pathfinder to choose initial values for a time-consuming model.
I’m not sure if this is a true bug or simply a system-specific setting that I need to add/change.
reprex:
# run previously: cmdstanr::rebuild_cmdstan()
library(cmdstanr)
file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
mod <- cmdstan_model(file) ## compiles successfully
modmm <- cmdstan_model(file, compile_model_methods = TRUE, force_recompile = TRUE) ## fails with error (see below)
Full error text
using C++ compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
using SDK: ‘’
clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include" -I"/private/var/folders/04/jbnbgfsj0y537r7cr7180dx40000gq/T/Rtmp8nes6X/sourceCpp-aarch64-apple-darwin20-1.0.12" -I/opt/homebrew/include -Wno-deprecated-declarations -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include' -O3 -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/src' -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src' -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/rapidjson_1.1.0/' -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/lib/CLI11-1.9.1/' -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/' -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/eigen_3.4.0' -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/boost_1.81.0' -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/sundials_6.1.1/include' -I'/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/sundials_6.1.1/src/sundials' -I"/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/cmdstanr/include" -fPIC -I/opt/homebrew/include -c file329153ecf53e.cpp -o file329153ecf53e.o
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /opt/homebrew/include/tbb/global_control.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/global_control.h:20:
/opt/homebrew/include/tbb/../oneapi/tbb/detail/_config.h:228:9: warning: '__TBB_CPP14_INTEGER_SEQUENCE_PRESENT' macro redefined [-Wmacro-redefined]
#define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__TBB_LANG >= 201402L)
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:235:13: note: previous definition is here
#define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__cplusplus >= 201402L)
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /opt/homebrew/include/tbb/global_control.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/global_control.h:20:
/opt/homebrew/include/tbb/../oneapi/tbb/detail/_config.h:243:17: warning: '__TBB_CPP17_DEDUCTION_GUIDES_PRESENT' macro redefined [-Wmacro-redefined]
#define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT 0
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:237:13: note: previous definition is here
#define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__has_feature(__cpp_deduction_guides))
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /opt/homebrew/include/tbb/global_control.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/global_control.h:20:
/opt/homebrew/include/tbb/../oneapi/tbb/detail/_config.h:264:9: warning: '__TBB_CPP17_MEMORY_RESOURCE_PRESENT' macro redefined [-Wmacro-redefined]
#define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (__TBB_LANG > 201402L) || \
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:352:9: note: previous definition is here
#define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (_MSVC_LANG > 201402L || __cplusplus > 201402L) || \
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /opt/homebrew/include/tbb/global_control.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/global_control.h:20:
/opt/homebrew/include/tbb/../oneapi/tbb/detail/_config.h:313:9: warning: '__TBB_CPP17_FALLTHROUGH_PRESENT' macro redefined [-Wmacro-redefined]
#define __TBB_CPP17_FALLTHROUGH_PRESENT (__TBB_LANG >= 201703L)
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:151:9: note: previous definition is here
#define __TBB_CPP17_FALLTHROUGH_PRESENT (__cplusplus >= 201703L)
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /opt/homebrew/include/tbb/global_control.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/global_control.h:20:
/opt/homebrew/include/tbb/../oneapi/tbb/detail/_config.h:336:9: warning: '__TBB_TSX_INTRINSICS_PRESENT' macro redefined [-Wmacro-redefined]
#define __TBB_TSX_INTRINSICS_PRESENT (__RTM__ || __INTEL_COMPILER || (_MSC_VER>=1700 && (__TBB_x86_64 || __TBB_x86_32)))
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:404:9: note: previous definition is here
#define __TBB_TSX_INTRINSICS_PRESENT ((__RTM__ || _MSC_VER>=1700 || __INTEL_COMPILER>=1300) && !__TBB_DEFINE_MIC && !__ANDROID__)
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /opt/homebrew/include/tbb/global_control.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/global_control.h:20:
/opt/homebrew/include/tbb/../oneapi/tbb/detail/_config.h:514:9: warning: '__TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING' macro redefined [-Wmacro-redefined]
#define __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING (TBB_PREVIEW_FLOW_GRAPH_FEATURES)
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:852:9: note: previous definition is here
#define __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING (TBB_PREVIEW_FLOW_GRAPH_FEATURES || __TBB_PREVIEW_OPENCL_NODE)
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /opt/homebrew/include/tbb/global_control.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/global_control.h:22:
/opt/homebrew/include/tbb/../oneapi/tbb/detail/_assert.h:46:9: warning: '__TBB_ASSERT_RELEASE' macro redefined [-Wmacro-redefined]
#define __TBB_ASSERT_RELEASE(predicate,message) ((predicate)?((void)0) : tbb::detail::r1::assertion_failure(__func__,__LINE__,#predicate,message))
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:134:10: note: previous definition is here
#define __TBB_ASSERT_RELEASE(predicate,message) ((predicate)?((void)0) : tbb::assertion_failure(__FILE__,__LINE__,#predicate,message))
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:9:
In file included from /opt/homebrew/include/tbb/parallel_reduce.h:17:
/opt/homebrew/include/tbb/../oneapi/tbb/parallel_reduce.h:386:57: error: reference to 'split' is ambiguous
lambda_reduce_body( lambda_reduce_body& other, tbb::split )
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:416:7: note: candidate found by name lookup is 'tbb::split'
class split {
^
/opt/homebrew/include/tbb/../oneapi/tbb/partitioner.h:667:15: note: candidate found by name lookup is 'tbb::v1::split'
using detail::split;
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:10:
In file included from /opt/homebrew/include/tbb/blocked_range.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/blocked_range.h:25:
/opt/homebrew/include/tbb/../oneapi/tbb/version.h:30:9: warning: 'TBB_VERSION_MAJOR' macro redefined [-Wmacro-redefined]
#define TBB_VERSION_MAJOR 2021
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:21:9: note: previous definition is here
#define TBB_VERSION_MAJOR 2020
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:10:
In file included from /opt/homebrew/include/tbb/blocked_range.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/blocked_range.h:25:
/opt/homebrew/include/tbb/../oneapi/tbb/version.h:32:9: warning: 'TBB_VERSION_MINOR' macro redefined [-Wmacro-redefined]
#define TBB_VERSION_MINOR 11
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:22:9: note: previous definition is here
#define TBB_VERSION_MINOR 3
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:10:
In file included from /opt/homebrew/include/tbb/blocked_range.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/blocked_range.h:25:
/opt/homebrew/include/tbb/../oneapi/tbb/version.h:43:9: warning: 'TBB_INTERFACE_VERSION' macro redefined [-Wmacro-redefined]
#define TBB_INTERFACE_VERSION 12110
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:25:9: note: previous definition is here
#define TBB_INTERFACE_VERSION 11103
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:10:
In file included from /opt/homebrew/include/tbb/blocked_range.h:17:
In file included from /opt/homebrew/include/tbb/../oneapi/tbb/blocked_range.h:25:
/opt/homebrew/include/tbb/../oneapi/tbb/version.h:45:9: warning: 'TBB_INTERFACE_VERSION_MAJOR' macro redefined [-Wmacro-redefined]
#define TBB_INTERFACE_VERSION_MAJOR (TBB_INTERFACE_VERSION/1000)
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:26:9: note: previous definition is here
#define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:62:54: error: reference to 'split' is ambiguous
recursive_reducer(recursive_reducer& other, tbb::split)
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:416:7: note: candidate found by name lookup is 'tbb::split'
class split {
^
/opt/homebrew/include/tbb/../oneapi/tbb/blocked_range.h:164:15: note: candidate found by name lookup is 'tbb::v1::split'
using detail::split;
^
In file included from file329153ecf53e.cpp:2:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:13:
In file included from /Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/functor.hpp:30:
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:77:54: error: reference to 'split' is ambiguous
recursive_reducer(recursive_reducer& other, tbb::split)
^
/Users/wpetry/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:416:7: note: candidate found by name lookup is 'tbb::split'
class split {
^
/opt/homebrew/include/tbb/../oneapi/tbb/parallel_for.h:463:15: note: candidate found by name lookup is 'tbb::v1::split'
using detail::split;
^
11 warnings and 3 errors generated.
make: *** [file329153ecf53e.o] Error 1
Error in Rcpp::sourceCpp(code = code, env = env, verbose = verbose) :
Error 1 occurred building shared library.
Operating System: OSX Sonoma 14.3.1
CmdStan Version: 2.34.1
cmdstanr Version: 0.7.1
Compiler/Toolkit: Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Hi, I hope it’s okay if I hijack this topic. I have a very similar problem. If I run the above code (or try to use $init_model_methods()) I, too, get the following errors
/usr/local/include/tbb/../oneapi/tbb/parallel_reduce.h:386:57: error: reference to 'split' is ambiguous
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:62:54: error: reference to 'split' is ambiguous
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:77:54: error: reference to 'split' is ambiguous
I have a version of tbb installed on my system (via Homebrew, it’s a dependency to some other packages), but I have not explicitly asked for it to be included. I don’t have a Makevars file.
> tools::makevars_user()
character(0)
Operating System: OSX Ventura 13.6.6
CmdStan Version: 2.34.1
cmdstanr Version: 0.7.1
Compiler/Toolkit: Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Complete output
using C++ compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
using SDK: ‘’
clang++ -std=gnu++17 -I"/usr/local/Cellar/r/4.4.0/lib/R/include" -DNDEBUG -I"/usr/local/lib/R/4.4/site-library/Rcpp/include" -I"/private/var/folders/nv/mz4ffsbn045101ngdd_mx0th0000gn/T/Rtmpi6hs9x/sourceCpp-x86_64-apple-darwin22.6.0-1.0.12" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -Wno-deprecated-declarations -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include’ -O3 -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/src’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/rapidjson_1.1.0/’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/lib/CLI11-1.9.1/’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/eigen_3.4.0’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/boost_1.81.0’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/sundials_6.1.1/include’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/sundials_6.1.1/src/sundials’ -I"/usr/local/lib/R/4.4/site-library/cmdstanr/include" -fPIC -g -O2 -c file2a0c2de8be5.cpp -o file2a0c2de8be5.o
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /usr/local/include/tbb/global_control.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/global_control.h:20:
/usr/local/include/tbb/…/oneapi/tbb/detail/_config.h:228:9: warning: ‘__TBB_CPP14_INTEGER_SEQUENCE_PRESENT’ macro redefined [-Wmacro-redefined] #define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__TBB_LANG >= 201402L)
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:235:13: note: previous definition is here #define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__cplusplus >= 201402L)
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /usr/local/include/tbb/global_control.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/global_control.h:20:
/usr/local/include/tbb/…/oneapi/tbb/detail/_config.h:243:17: warning: ‘__TBB_CPP17_DEDUCTION_GUIDES_PRESENT’ macro redefined [-Wmacro-redefined] #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT 0
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:237:13: note: previous definition is here #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__has_feature(__cpp_deduction_guides))
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /usr/local/include/tbb/global_control.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/global_control.h:20:
/usr/local/include/tbb/…/oneapi/tbb/detail/_config.h:264:9: warning: ‘__TBB_CPP17_MEMORY_RESOURCE_PRESENT’ macro redefined [-Wmacro-redefined] #define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (__TBB_LANG > 201402L) ||
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:352:9: note: previous definition is here #define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (_MSVC_LANG > 201402L || __cplusplus > 201402L) ||
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /usr/local/include/tbb/global_control.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/global_control.h:20:
/usr/local/include/tbb/…/oneapi/tbb/detail/_config.h:313:9: warning: ‘__TBB_CPP17_FALLTHROUGH_PRESENT’ macro redefined [-Wmacro-redefined] #define __TBB_CPP17_FALLTHROUGH_PRESENT (__TBB_LANG >= 201703L)
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:151:9: note: previous definition is here #define __TBB_CPP17_FALLTHROUGH_PRESENT (__cplusplus >= 201703L)
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /usr/local/include/tbb/global_control.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/global_control.h:20:
/usr/local/include/tbb/…/oneapi/tbb/detail/_config.h:336:9: warning: ‘__TBB_TSX_INTRINSICS_PRESENT’ macro redefined [-Wmacro-redefined] #define __TBB_TSX_INTRINSICS_PRESENT (RTM || __INTEL_COMPILER || (_MSC_VER>=1700 && (__TBB_x86_64 || __TBB_x86_32)))
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:404:9: note: previous definition is here #define __TBB_TSX_INTRINSICS_PRESENT ((RTM || _MSC_VER>=1700 || __INTEL_COMPILER>=1300) && !__TBB_DEFINE_MIC && !ANDROID)
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /usr/local/include/tbb/global_control.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/global_control.h:20:
/usr/local/include/tbb/…/oneapi/tbb/detail/_config.h:514:9: warning: ‘__TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING’ macro redefined [-Wmacro-redefined] #define __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING (TBB_PREVIEW_FLOW_GRAPH_FEATURES)
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_config.h:852:9: note: previous definition is here #define __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING (TBB_PREVIEW_FLOW_GRAPH_FEATURES || __TBB_PREVIEW_OPENCL_NODE)
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:17:
In file included from /usr/local/include/tbb/global_control.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/global_control.h:22:
/usr/local/include/tbb/…/oneapi/tbb/detail/_assert.h:46:9: warning: ‘__TBB_ASSERT_RELEASE’ macro redefined [-Wmacro-redefined] #define __TBB_ASSERT_RELEASE(predicate,message) ((predicate)?((void)0) : tbb::detail::r1::assertion_failure(func,LINE,#predicate,message))
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:134:10: note: previous definition is here #define __TBB_ASSERT_RELEASE(predicate,message) ((predicate)?((void)0) : tbb::assertion_failure(FILE,LINE,#predicate,message))
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:9:
In file included from /usr/local/include/tbb/parallel_reduce.h:17:
/usr/local/include/tbb/…/oneapi/tbb/parallel_reduce.h:386:57: error: reference to ‘split’ is ambiguous
lambda_reduce_body( lambda_reduce_body& other, tbb::split )
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:416:7: note: candidate found by name lookup is ‘tbb::split’
class split {
^
/usr/local/include/tbb/…/oneapi/tbb/partitioner.h:667:15: note: candidate found by name lookup is ‘tbb::v1::split’
using detail::split;
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:10:
In file included from /usr/local/include/tbb/blocked_range.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/blocked_range.h:25:
/usr/local/include/tbb/…/oneapi/tbb/version.h:30:9: warning: ‘TBB_VERSION_MAJOR’ macro redefined [-Wmacro-redefined] #define TBB_VERSION_MAJOR 2021
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:21:9: note: previous definition is here #define TBB_VERSION_MAJOR 2020
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:10:
In file included from /usr/local/include/tbb/blocked_range.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/blocked_range.h:25:
/usr/local/include/tbb/…/oneapi/tbb/version.h:32:9: warning: ‘TBB_VERSION_MINOR’ macro redefined [-Wmacro-redefined] #define TBB_VERSION_MINOR 12
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:22:9: note: previous definition is here #define TBB_VERSION_MINOR 3
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:10:
In file included from /usr/local/include/tbb/blocked_range.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/blocked_range.h:25:
/usr/local/include/tbb/…/oneapi/tbb/version.h:47:9: warning: ‘TBB_INTERFACE_VERSION’ macro redefined [-Wmacro-redefined] #define TBB_INTERFACE_VERSION 12120
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:25:9: note: previous definition is here #define TBB_INTERFACE_VERSION 11103
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:10:
In file included from /usr/local/include/tbb/blocked_range.h:17:
In file included from /usr/local/include/tbb/…/oneapi/tbb/blocked_range.h:25:
/usr/local/include/tbb/…/oneapi/tbb/version.h:49:9: warning: ‘TBB_INTERFACE_VERSION_MAJOR’ macro redefined [-Wmacro-redefined] #define TBB_INTERFACE_VERSION_MAJOR (TBB_INTERFACE_VERSION/1000)
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:26:9: note: previous definition is here #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:12:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/fun.hpp:200:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor.hpp:30:
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:62:54: error: reference to ‘split’ is ambiguous
recursive_reducer(recursive_reducer& other, tbb::split)
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:416:7: note: candidate found by name lookup is ‘tbb::split’
class split {
^
/usr/local/include/tbb/…/oneapi/tbb/blocked_range.h:164:15: note: candidate found by name lookup is ‘tbb::v1::split’
using detail::split;
^
In file included from file2a0c2de8be5.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:13:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/functor.hpp:30:
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:77:54: error: reference to ‘split’ is ambiguous
recursive_reducer(recursive_reducer& other, tbb::split)
^
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_stddef.h:416:7: note: candidate found by name lookup is ‘tbb::split’
class split {
^
/usr/local/include/tbb/…/oneapi/tbb/parallel_for.h:463:15: note: candidate found by name lookup is ‘tbb::v1::split’
using detail::split;
^
11 warnings and 3 errors generated.
make: *** [file2a0c2de8be5.o] Error 1
Fehler in Rcpp::sourceCpp(code = code, env = env, verbose = verbose) :
Error 1 occurred building shared library.
I’m guessing you’ve installed R via the homebrew formula (brew install r) instead of the cask (brew install --cask r) here. This has the effect of automatically adding homebrew’s packages to the start of the include path - which means that the homebrew TBB is found before CmdStan’s.
You’ve got two options here:
Uninstall the current R and install the cask version instead (bit of a nuclear approach)
Configure CmdStan to always use the homebrew TBB (I’d recommend trying this first)
To use the Homebrew TBB with CmdStan, you need to add the paths for the header files and shared libraries to your make/local file. You can do this from R using the following:
brew_prefix <- system2("brew", "--prefix", stdout = TRUE)
TBB_INC <- shQuote(paste0(brew_prefix, "/include"))
TBB_LIB <- shQuote(paste0(brew_prefix, "/lib"))
cpp_options <- list(
TBB_INC = TBB_INC,
TBB_LIB = TBB_LIB,
TBB_INTERFACE_NEW = "true",
# Currently have to override linker flags due to Math lib bug
LDFLAGS_TBB = paste0("-Wl,-L,", TBB_LIB, " -Wl,-rpath,", TBB_LIB)
)
cmdstanr::cmdstan_make_local(cpp_options = cpp_options, append = TRUE)
cmdstanr::rebuild_cmdstan(cores=8)
I found that there was a bug in our Makefiles on MacOS for this, so we have to also manually set the linker flags for now (fixed in this PR)
Thanks, Andrew. I indeed installed R via the formula. I tried the second approach you recommend and I think there is progress. I’m now seeing a different error:
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:9:10: fatal error: 'tbb/tbb_stddef.h' file not found
#include <tbb/tbb_stddef.h>
I suspect that this is somehow related to a seemingly incorrect path specification. In the output I also see:
using C++ compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
using SDK: ‘’
clang++ -std=gnu++17 -I"/usr/local/Cellar/r/4.4.0/lib/R/include" -DNDEBUG -I"/usr/local/lib/R/4.4/site-library/Rcpp/include" -I"/private/var/folders/nv/mz4ffsbn045101ngdd_mx0th0000gn/T/RtmpMzWfLB/sourceCpp-x86_64-apple-darwin22.6.0-1.0.12" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include -Wno-deprecated-declarations -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1//usr/local/include’ -O3 -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/src’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/rapidjson_1.1.0/’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/lib/CLI11-1.9.1/’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/eigen_3.4.0’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/boost_1.81.0’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/sundials_6.1.1/include’ -I’/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/lib/sundials_6.1.1/src/sundials’ -I"/usr/local/lib/R/4.4/site-library/cmdstanr/include" -fPIC -g -O2 -c filea8c160988df.cpp -o filea8c160988df.o
In file included from filea8c160988df.cpp:2:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from /Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core.hpp:4:
/Users/USERNAME/.cmdstan/cmdstan-2.34.1/stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:9:10: fatal error: ‘tbb/tbb_stddef.h’ file not found #include <tbb/tbb_stddef.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [filea8c160988df.o] Error 1