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)

TBB version: `stable 2021.11.0`

`.R/Makevars`

:

```
CXX14FLAGS = -DSTAN_THREADS -pthread
CXX14FLAGS += -O3 -march=native -mtune=native
CXX14FLAGS += -fPIC
CFLAGS = -I/opt/homebrew/include
CPPFLAGS = -I/opt/homebrew/include
CXXFLAGS = -I/opt/homebrew/include
# homebrew alternative
FLIBS = -L/opt/homebrew/opt/gfortran/lib
F77 = /opt/homebrew/bin/gfortran
FC = /opt/homebrew/bin/gfortran
```