Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

system.file("include", package = "BH") returns empty string #94

Closed
robmoss opened this issue Sep 13, 2023 · 4 comments
Closed

system.file("include", package = "BH") returns empty string #94

robmoss opened this issue Sep 13, 2023 · 4 comments

Comments

@robmoss
Copy link

robmoss commented Sep 13, 2023

My apologies if I've missed something obvious.

I'm using RStan on several Debian and Ubuntu machines, and have installed the r-cran-stan and r-cran-bh packages with apt. RStan complains that boost cannot be found and that I should install BH. It seems this is because Rstan sets its option boost_lib <- system.file("include", package = "BH") and this directory doesn't exist. I either have to manually set boost_lib to "/usr/include/boost", or create an "include" directory:

sudo ln -s /usr/include/boost /usr/lib/R/site-library/BH/include

Should the Debian/Ubuntu r-cran-bh package automatically create the above symlink when it is installed?

@eddelbuettel
Copy link
Owner

Do a dpkg -L r-cran-bh: it is an empty virtual shell. For a reason: BH has a footprint of 150mb installed and on Debian you do not need it. Use libboost-all-dev instead.

That said, why did you think boost_lib <- system.file("include", package = "BH") was a good idea? Besides the obvious gotcha of calling something _lib when it checks for includes.

Anyway, if this is handed down from rstan than you may have not choice but to install.packages("BH") and waste those 150mb if that is how rstan wants to access it. It should know better (we often use configure or cmake).

In any event this is not an issue of the CRAN package BH where you filed the issue but with the (trying to be helpful) Debian package r-cran-bh. I stand behind both so I can help so fire up if you have questions.

@robmoss
Copy link
Author

robmoss commented Sep 13, 2023

Sorry for filing the issue here rather than Debian/Ubuntu bug trackers, I wasn't sure which was the most appropriate. It's obvious in hindsight.

That said, why did you think boost_lib <- system.file("include", package = "BH") was a good idea? Besides the obvious gotcha of calling something _lib when it checks for includes.

This is how rstan locates the boost header files when compiling a model (at least, on my Ubuntu and Debian machines).

I knew that r-cran-bh is an empty package, but I didn't appreciate that install.packages("BH") installed a second copy of the boost header files. So I assumed that the r-cran-bh package would (or should) work with rstan without any further actions on my part.

@robmoss robmoss closed this as completed Sep 13, 2023
@eddelbuettel
Copy link
Owner

It is kinda the other way around:

  • install.packages("BH") is an R function that does not know it is on Debian, it installs full BH
  • r-cran-bh is a small hack attempting to save the second installation of Boost (besides libboost-*)
  • rstan does not know about point 2) (not should it) so it ask "where is BH"
  • what should really happy is for Boost to work with pkg-config because a ton of CRAN packages use that to find include and library locations

@robmoss
Copy link
Author

robmoss commented Sep 13, 2023

Thank you very much for the explanation Dirk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants