Error while loading shared libraries while using "$generate_quantities"

Hello, I am a new R + Stan user. Would it be possible to share any advice on how I can debug the following problem?

I have completed an Hamiltonian MC run using STAN via the cmdstanr interface in R. While trying to use “$generate_quantities()” method using the fitted parameters, I receive the following error in each of my chains similar to this one:

"Chain 1. ./[model name]: error while loading shared libraries: libtbb.so.2: cannot open shared object file: No such file or directory"

Please note:

  • Operating System: Unix
  • CmdStan Version: cmdstan-2.28.2, cmdstanr_0.3.0

Thank you for your time and advice.

Does your cmdstan’s path cmdstan/stan/lib/stan_math/lib/tbb contains a file “libtbb” alike? If not you can rebuild cmdstan. Note that you’ll need to compile the model with generated quantities block. Please also consider upgrade to cmdstanr 0.4.0.

2 Likes

Thank you for this advice. I did verify that the cmdstan-2.28.2/stan/lib/stan_math/lib/tbb/libtbb.so.2 does exist. I have also verified that the stan model has the generated quantities block.

I also checked that cmdstan_path() does point to the correct cmdstan-2.28.2 directory. Any thoughts why then the compiler is not able to ‘see’ the libtbb.so.2 file?

The issue is now fixed. It got fixed after I deleted the previous executable, and compiled a fresh one. Most likely the library path was not configured correctly in the previous executable. Thanks to yizhang for pointing me in the right direction.

1 Like