Errors when developing a package with stan functionality

Hello, I’m trying to add stan capabilities to a package via rstantools::use_rstan().

I’m starting to have a bunch of errors around. I’m working on MacOs 10.15.3 and R v4.0. I can run rstan without problems outside the development of the package. rstantools is v2.1.0, rstan is 2.19.3

Here is the error that I see if I run either pkgbuild::compile_dll(force = T), devtools::document() or devtools::install()

clang++ -mmacosx-version-min=10.13 -std=gnu++14 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o PooledPrevalence.so RcppExports.o stanExports_Estimation_model.o stanExports_Estimation_model_sens.o -L’/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppParallel/lib/’ -Wl,-rpath /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppParallel/lib/ -ltbb -ltbbmalloc -F/Library/Frameworks/R.framework/… -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option ‘-L’/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppParallel/lib/’’
ld: library not found for -ltbb
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [PooledPrevalence.so] Error 1
ERROR: compilation failed for package ‘PooledPrevalence’

Thanks!

ld: warning: directory not found for option ‘-L’/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppParallel/lib/’’
ld: library not found for -ltbb

These errors indicate that the RcppParallel isn’t installed (or can’t be found). Can you check that it’s installed, or maybe try reinstalling?

I reinstalled it but no change. I checked the directory and it exists. RcppParallel is also listed in my DESCRIPTION file after a LinkingTo directive, so I guess it should self install in case is missing isn’t it?

We’re testing some potential fixes for this issue now.

eheh i don’t know if should relieved or not that it doesn’t depend from me 😂😂😂

Thanks and keep me updated!

In case you want to do testing, you just need to clone the dev branch of this repo GitHub - EU-ECDC/PooledPrevalence: A set of tools to help design a laboratory based prevalence study harnessing the pooling of laboratory samples to increase resource efficiency.