Please remove LDLIBS_TB from stan/lib/stan_math/make/compiler_flags
Describe the bug The two lines:
LDLIBS_TBB ?= -ltbb
in:
stan/lib/stan_math/make/compiler_flags
add:
-ltbb
in the Linking model command before:
stan/lib/stan_math/lib/tbb/libtbb.so.2
thus always selecting the system tbb and producing the error:
/u/local/compilers/gcc/10.2.0/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/cmdstan/main.o: in function `cmdstan::command(int, char const**)': main.cpp:(.text+0x28d3f): undefined reference to `tbb::interface7::internal::task_arena_base::internal_initialize()' /u/local/compilers/gcc/10.2.0/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: main.cpp:(.text+0x2a77e): undefined reference to `tbb::interface9::global_control::internal_create()' /u/local/compilers/gcc/10.2.0/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/cmdstan/main.o: in function `tbb::interface7::task_arena::~task_arena()': main.cpp:(.text._ZN3tbb10interface710task_arenaD2Ev[_ZN3tbb10interface710task_arenaD5Ev]+0x15): undefined reference to `tbb::interface7::internal::task_arena_base::internal_terminate()' /u/local/compilers/gcc/10.2.0/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/cmdstan/main.o: in function `tbb::interface9::global_control::~global_control()': main.cpp:(.text._ZN3tbb10interface914global_controlD2Ev[_ZN3tbb10interface914global_controlD5Ev]+0x5): undefined reference to `tbb::interface9::global_control::internal_destroy()' collect2: error: ld returned 1 exit status make: *** [examples/bernoulli/bernoulli] Error 1
To Reproduce
Try building the bernoulli example (on a CentOS 7 system)
Expected behavior A description of what you expected to happen.
After removing the offending lines I can proceed to linking the model correctly.
Operating system Your operating system (e.g. mac os x 10.15, windows 10, etc.)
CentOS 7.9
CmdStanR version number
Your CmdStanR version number (e.g. from packageVersion("cmdstanr")).
2.36.0
Additional context Add any other context about the problem here.
This looks like a general CmdStan issue, not specifically the CmdStanR interface, so I'm going to transfer the issue to the CmdStan repository.
the ? in ?= means that the flag is only set if it isn't already, so you can manually set it in your environment or in make/local to customize to your specific system. You can go either way, customizing it to use the system tbb entirely or stan's tbb
@WardBrian even when I experimented with the make/local it wasn't immediately obvious how to fix the issue given the way that the built command is currently put together, that is it uses LDLIBS_TBB before stan/lib/stan_math/lib/tbb/libtbb.so.2 at least the order should be changed