stan-dev / stan-dev/rstanarm

rstanarm build error: Library not loaded: @rpath/libtbb.dylib

Open
#581 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
401
Forks
136
PR merge metrics
No merged PRs in 30d

Description

I am making an implementation for R packages in Macports now, and I would like to have rstanarm among supported packages. This is still WIP, however what mostly remains to be done is fine-tuning for Macports environment. That is, pretty much everything already builds fine – both locally on my machines and on Macports build bots.

I get an error, however, with rstanarm: for some reason, it cannot find libtbb.dylib, even though it is there (see log below).
No external version of TBB is installed, so the failure is not caused by duplicate dylibs. Existing libtbb.dylib is sitting in RcppParallel package, and linker flag is pointing to the correct location: -L/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/lib/ -ltbb -ltbbmalloc. Yet when testing package loading, it fails to find it.

:info:destroot /opt/local/bin/g++-mp-12 -std=gnu++14 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"../inst/include" -I"/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/StanHeaders/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rstan/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/BH/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppEigen/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/include' -I/opt/local/include  `"/opt/local/Library/Frameworks/R.framework/Resources/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"/opt/local/Library/Frameworks/R.framework/Resources/bin/Rscript" -e "StanHeaders:::CxxFlags()"` -fPIC  -pipe -Os -arch ppc  -c init.cpp -o init.o
:info:destroot /opt/local/bin/g++-mp-12 -std=gnu++14 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/Library/Frameworks/R.framework/Resources/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-rpath,/opt/local/lib/libgcc -arch ppc -o rstanarm.so stan_files/bernoulli.o stan_files/binomial.o stan_files/continuous.o stan_files/count.o stan_files/jm.o stan_files/lm.o stan_files/mvmer.o stan_files/polr.o init.o -L/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppParallel/lib/ -ltbb -ltbbmalloc -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
:info:destroot rm stan_files/binomial.cc stan_files/jm.cc stan_files/continuous.cc stan_files/bernoulli.cc stan_files/lm.cc stan_files/polr.cc stan_files/count.cc stan_files/mvmer.cc
:info:destroot installing to /opt/local/var/macports/build/_opt_PPCRosettaPorts_R_R-rstanarm/R-rstanarm/work/destroot/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-stan-dev-rstanarm-e63e48a/00new/rstanarm/libs
:info:destroot ** R
:info:destroot ** data
:info:destroot *** moving datasets to lazyload DB
:info:destroot ** demo
:info:destroot ** inst
:info:destroot ** byte-compile and prepare package for lazy loading
:info:destroot ** help
:info:destroot No man pages found in package  ‘rstanarm’ 
:info:destroot *** installing help indices
:info:destroot *** copying figures
:info:destroot ** building package indices
:info:destroot ** installing vignettes
:info:destroot ** testing if installed package can be loaded from temporary location
:info:destroot Error: package or namespace load failed for ‘rstanarm’ in dyn.load(file, DLLpath = DLLpath, ...):
:info:destroot  unable to load shared object '/opt/local/var/macports/build/_opt_PPCRosettaPorts_R_R-rstanarm/R-rstanarm/work/destroot/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-stan-dev-rstanarm-e63e48a/00new/rstanarm/libs/rstanarm.so':
:info:destroot   dlopen(/opt/local/var/macports/build/_opt_PPCRosettaPorts_R_R-rstanarm/R-rstanarm/work/destroot/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-stan-dev-rstanarm-e63e48a/00new/rstanarm/libs/rstanarm.so, 6): Library not loaded: @rpath/libtbb.dylib
:info:destroot   Referenced from: /opt/local/var/macports/build/_opt_PPCRosettaPorts_R_R-rstanarm/R-rstanarm/work/destroot/opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-stan-dev-rstanarm-e63e48a/00new/rstanarm/libs/rstanarm.so
:info:destroot   Reason: image not found
:info:destroot Error: loading failed
:info:destroot Execution halted
:info:destroot ERROR: loading failed

P. S. It is probably desirable to dump an old tbb in RcppParallel altogether and use an external oneTBB (given that we have fixed it for ppc32, so all macOS are covered), but I am not sure if that gonna work smoothly, since ABI has changed quite a bit.

@andrjohns @WardBrian Any ideas here?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MacPorts build log and the rstanarm package-loading step that calls dyn.load on rstanarm.so; inspect how the RcppParallel lib directory and @rpath/libtbb.dylib are made available. Reproduce the failure in the stated MacPorts R 4.2 PPC environment, then verify that rstanarm installs and loads successfully without the missing-library error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.