cmdstan icon indicating copy to clipboard operation
cmdstan copied to clipboard

Please remove LDLIBS_TB from stan/lib/stan_math/make/compiler_flags

Open rdauria opened this issue 4 months ago • 3 comments

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.

rdauria avatar Aug 26 '25 17:08 rdauria