Cmdstan installation fails on linux - issue with tbb?

I wish my first post would not be about an installation issue… but here I am! Yesterday, I upgraded my linux system from Fedora 37 to Fedora 38 and noticed I could not compile Stan models with cmdstanr anymore. I have tried to reinstall cmdstan multiple ways (through cmdstanr in R, or using make on github downloads of v2.31.0 and v2.32.0-rc1) but it keeps failing. According to cmdstanr::check_cmdstan_toolchain(), my C++ toolchain is setup properly. The problem seems to be related with “tbb”.

example of error message with cmdstanr::install_cmdstan():

../tbb_2020.3/include/tbb/task.h:300:20: error: declaration of ‘tbb::task& tbb::internal::task_prefix::task()’ changes meaning of ‘task’ [-Wchanges-meaning]

and the installation stops with:

make[1]: *** [../tbb_2020.3/build/common_rules.inc:80: pipeline.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/username/.cmdstan/cmdstan-2.31.0/stan/lib/stan_math/lib/tbb'
make: *** [stan/lib/stan_math/make/libraries:169: stan/lib/stan_math/lib/tbb/tbb.def] Error 2
make: *** Waiting for unfinished jobs....
make: *** [make/command:5: bin/cmdstan/print.o] Error 1
make: *** [make/command:5: bin/cmdstan/stansummary.o] Error 1
make: *** [make/command:5: bin/cmdstan/diagnose.o] Error 1
make: *** [make/program:14: src/cmdstan/main.o] Error 1
make: *** [make/program:27: stan/src/stan/model/model_header.hpp.gch] Error 1

example of error message using make on v2.32.0-rc1:

stan/lib/stan_math/lib/tbb_2020.3/include/tbb/task.h:300:20: error: declaration of ‘tbb::task& tbb::internal::task_prefix::task()’ changes meaning of ‘task’ [-Wchanges-meaning]

Any hint of what could be wrong on my side?

Fedora 38 seems to have updated to GCC 13, which is the source of this error. TBB themselves fixed it here:

The fix was to change this line:

to tbb::task* next_offloaded;

We should consider either applying this patch ourselves in the math library or updating our vendored copy of TBB. (pinging @andrjohns @rok_cesnovar @wds15 - how would we like to handle this?)

For now, if it’s acceptable to you, making this change to your downloaded copy should allow the build to succeed @Unlearned5341

1 Like

Awesome, it works. Thank you @WardBrian

1 Like

Thank you for reporting! We should have this patched in the actual 2.32 release