eddelbuettel / bh

R package providing Boost Header files
85 stars 33 forks source link

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

Closed robmoss closed 10 months ago

robmoss commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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.

eddelbuettel commented 10 months ago

It is kinda the other way around:

robmoss commented 10 months ago

Thank you very much for the explanation Dirk.