Open tillea opened 1 year ago
Stan can be compiled against oneTBB by defining TBB_INTERFACE_NEW during compilation (I am not 100% certain that this is available in the current stanheaders, but it was starting in version 2.26 other places)
Well, to "compile" StanHeaders we have added -DTBB_INTERFACE_NEW
. However, when using those headers for instance to build rstan
I guess this has to be set as well. To test what I'm guessing I did a new build by setting -DTBB_INTERFACE_NEW also when building the r-cran-rstan
package. Please have a look at the log when trying to build rstan. It reproduces the two related bugs I've mentioned above:
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DTBB_INTERFACE_NEW -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"/usr/lib/R/site-library/StanHeaders/include/src" - DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_REENTRANT -DSTAN_THREADS -DUSE_STANC3 -DSTRICT_R_HEADERS -D_HAS_AUTO_PTR_ETC=0 -I'/usr/lib/R/site-library/Rcpp/ include' -I'/usr/lib/R/site-library/RcppEigen/include' -I'/usr/lib/R/site-library/BH/include' -I'/usr/lib/R/site-library/StanHeaders/include' -I'/usr/lib/R/site-library/RcppParallel/ include' -DSTRICT_R_HEADERS -fpic -g -O2 -ffile-prefix-map=/build/reproducible-path/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time - D_FORTIFY_SOURCE=2 -c Module.cpp -o Module.o
In file included from /usr/lib/R/site-library/StanHeaders/include/stan/math/prim/core.hpp:4,
from /usr/lib/R/site-library/StanHeaders/include/stan/math/rev/core/Eigen_NumTraits.hpp:5,
from /usr/lib/R/site-library/StanHeaders/include/stan/math/rev/core/typedefs.hpp:7,
from /usr/lib/R/site-library/StanHeaders/include/stan/math/rev/core/chainable_object.hpp:6,
from /usr/lib/R/site-library/StanHeaders/include/stan/math/rev/core.hpp:10,
from /usr/lib/R/site-library/StanHeaders/include/src/stan/model/model_base.hpp:5,
from Module.cpp:2:
/usr/lib/R/site-library/StanHeaders/include/stan/math/prim/core/init_threadpool_tbb.hpp:1: error: unterminated #ifndef
1 | #ifndef STAN_MATH_PRIM_CORE_INIT_THREADPOOL_TBB_HPP
|
Any idea what might be wrong here?
Kind regards, Andreas.
Thanks to Nilesh Patra this was solved in this patch
Thanks @tillea I think we should add that patch to stan math I'll open up a PR for that
It’s already in Stan math, it was a backport
Am Thu, Oct 26, 2023 at 07:21:26AM -0700 schrieb Brian Ward:
It’s already in Stan math, it was a backport
It would be great if it would somehow endup in the tarball that can be downloaded from
https://cran.r-project.org/package=StanHeaders
Kind regards, Andreas.
My understanding is that the next version of stanheaders uploaded to cran is intended to be 2.32, which would include this fix
Summary:
This report is about stanheaders. Actually the issue occures on the Debian packaged source that is available at CRAN. It is using a header file that was available in the Debian packaged TBB library of version 2020.3 but droped in 2021.4.0 (together with the rename to
onetbb
which has broken the oldtbb
interface).My attempt to build
rstanarm
ended up insince the header file
task_scheduler_init.h
does not exist any more inonetbb
since 2021.Description:
The issue becomes visible in different ways when StanHeaders is used. There is a complete build log when trying to build rstanarm (which reproduces the code cited above). You can also have a look at the complete build log od rstan in the CI of the
rstan
Debian package.The following bug reports in Debian seems to be closely related to the outdated tbb interface:
Reproducible Steps:
You should be able to reproduce the issue when creating a Debian
unstable
(==sid
) container / chroot and build the packagesr-cran-rstan
orr-cran-rstanarm
.RStan Version:
StanHeaders
: Version: 2.26.28rstanarm
: 2.21.4 (This has built before for whatever reason. For the moment I can't build it due to the requirement of higher version ofrstan
which does not build)rstan
: 2.32.3R Version:
Debian package of version 4.3.1
Operating System:
Debian unstable